本文整理汇总了PHP中Zend_Wildfire_Plugin_FirePhp_TableMessage::addRow方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Wildfire_Plugin_FirePhp_TableMessage::addRow方法的具体用法?PHP Zend_Wildfire_Plugin_FirePhp_TableMessage::addRow怎么用?PHP Zend_Wildfire_Plugin_FirePhp_TableMessage::addRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Wildfire_Plugin_FirePhp_TableMessage
的用法示例。
在下文中一共展示了Zend_Wildfire_Plugin_FirePhp_TableMessage::addRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPanel
/**
* Gets content panel for the Debugbar
*
* @return string
*/
public function getPanel()
{
$html = '<h4>Registered Instances</h4>';
$this->_registry->ksort();
foreach ($this->_registry as $k => $v) {
if (is_object($v)) {
$this->message->addRow(array($k, get_class($v)));
} else {
$this->message->addRow(array($k, $v));
}
}
}
示例2: stopQuery
public function stopQuery()
{
$executionMS = \microtime(true) - $this->_curQuery->startTime;
$this->_totalMS += $executionMS;
++$this->_queryCount;
$this->_message->addRow(array(number_format($executionMS, 5), $this->_curQuery->sql, $this->_curQuery->params));
$this->updateLabel();
}
示例3: stopQuery
public function stopQuery()
{
$elapsedTime = microtime(true) - $this->_currentQuery['startTime'];
$this->_totalElapsedTime += $elapsedTime;
++$this->_queryCount;
$this->_message->addRow(array(round($elapsedTime, 5), $this->_currentQuery['sql'], $this->_currentQuery['parameters']));
$this->_updateMessageLabel();
}
示例4: getPanel
/**
* Gets content panel for the Debugbar
*
* @return string
*/
public function getPanel()
{
$username = 'Not Authed';
$role = 'Unknown Role';
if ($this->_auth->hasIdentity()) {
foreach ($this->_auth->getIdentity() as $property => $value) {
$this->message->addRow(array((string) $property, (string) $value));
}
} else {
// $this->message->setMessage('Not authorized');
}
return '';
}
示例5: debug
/**
* dump
*
* @return string
*/
public static function debug()
{
$backtrace = debug_backtrace();
// get variable name
$arrLines = file($backtrace[0]["file"]);
$code = $arrLines[$backtrace[0]["line"] - 1];
$arrMatches = array();
// find call to Sys::dump
preg_match('/\\b\\s*Core_Debug::debug\\s*\\(\\s*(.+)\\s*\\);\\s*/i', $code, $arrMatches);
$varName = isset($arrMatches[1]) ? $arrMatches[1] : '???';
$trace = array();
foreach ($backtrace as $rec) {
if (isset($rec['function'])) {
$t['call'] = '';
if (isset($rec['class'])) {
$t['call'] .= $rec['class'] . $rec['type'] . $rec['function'];
} else {
$t['call'] .= $rec['function'];
}
$t['call'] .= '(';
if (sizeof($rec['args'])) {
foreach ($rec['args'] as $arg) {
if (is_object($arg)) {
$t['call'] .= get_class($arg);
} else {
$arg = str_replace("\n", ' ', (string) $arg);
$t['call'] .= '"' . (strlen($arg) <= 30 ? $arg : substr($arg, 0, 25) . '[...]') . '"';
}
$t['call'] .= ', ';
}
$t['call'] = substr($t['call'], 0, -2);
}
$t['call'] .= ")";
}
$t['file'] = @$rec['file'] . ':' . @$rec['line'];
$trace[] = $t;
}
$debug = new Zend_Wildfire_Plugin_FirePhp_TableMessage('Debug');
$debug->setBuffered(true);
$debug->setHeader(array('Value and BackTrace'));
$debug->setOption('includeLineNumbers', false);
foreach (func_get_args() as $var) {
$debug->addRow(array($var));
}
$debug->addRow(array($trace));
$where = basename($backtrace[0]["file"]) . ':' . $backtrace[0]["line"];
$debug->setLabel("Debug: {$varName} ({$where})");
Zend_Wildfire_Plugin_FirePhp::getInstance()->send($debug);
}
示例6: getPanel
/**
* Gets content panel for the Debugbar
*
* @return string
*/
public function getPanel()
{
$this->_request = Zend_Controller_Front::getInstance()->getRequest();
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewVars = $viewRenderer->view->getVars();
foreach ($viewVars as $k => $v) {
$this->message->addRow(array($k . " - View", self::_cleanData($v)));
}
foreach ($this->_request->getParams() as $k => $v) {
$this->message->addRow(array($k . " - Parameter", self::_cleanData($v)));
}
foreach ($this->_request->getCookie() as $k => $v) {
$this->message->addRow(array($k . " - Cookie", self::_cleanData($v)));
}
}
示例7: recordEvent
/**
* Insert a record in the queries table
*
* @param Doctrine_Event $event the event to log
*
* @throws Zend_Db_Profiler_Exception
*
* @return void
*/
public function recordEvent($event)
{
$this->message->setDestroy(false);
// update time counter
$this->totalElapsedTime += $event->getElapsedSecs();
// add a row to the table
$this->message->addRow(array((string) round($event->getElapsedSecs(), 5), $event->getQuery() ? $event->getQuery() : $event->getName(), ($params = $event->getParams()) ? $params : null));
// increment number of queries
$this->totalNumQueries++;
}
示例8: getPanel
/**
* Gets content panel for the Debugbar
*
* @return string
*/
public function getPanel()
{
$included = $this->_getIncludedFiles();
$libraryFiles = array();
foreach ($included as $file) {
$file = str_replace($this->_basePath, '', $file);
$this->message->addRow(array($file));
}
$this->message->addRow($libraryFiles);
}
示例9: queryEnd
/**
* Intercept the query end and log the profiling data.
*
* @param integer $queryId
* @throws Zend_Db_Profiler_Exception
* @return void
*/
public function queryEnd($queryId)
{
$state = parent::queryEnd($queryId);
if (!$this->getEnabled() || $state == self::IGNORED) {
return;
}
$this->_message->setDestroy(false);
$profile = $this->getQueryProfile($queryId);
$this->_totalElapsedTime += $profile->getElapsedSecs();
$this->_message->addRow(array((string) round($profile->getElapsedSecs(), 5), $profile->getQuery(), ($params = $profile->getQueryParams()) ? $params : null));
$this->updateMessageLabel();
}
示例10: __call
/**
* method overloader
* this method is used for invoking different listeners, for the full
* list of availible listeners, see Doctrine_EventListener
*
* @param string $m the name of the method
* @param array $a method arguments
* @see Doctrine_EventListener
* @return boolean
*/
public function __call($methodName, $arguments)
{
if (!$arguments[0] instanceof Doctrine_Event) {
throw new Doctrine_Connection_Profiler_Exception("Couldn't listen event. Event should be an instance of Doctrine_Event.");
}
if (substr($methodName, 0, 3) == 'pre') {
$arguments[0]->start();
if (!in_array($arguments[0], $this->_events, true)) {
$this->_events[] = $arguments[0];
}
} else {
// we need after-event listeners
$arguments[0]->end();
$this->_message->setDestroy(false);
$this->_totalElapsedTime += $arguments[0]->getElapsedSecs();
$row = array($arguments[0]->getName(), round($arguments[0]->getElapsedSecs(), 5), $arguments[0]->getQuery(), ($params = $arguments[0]->getParams()) ? $params : null);
$this->_message->addRow($row);
$this->updateMessageLabel();
}
}
示例11: stopQuery
public function stopQuery()
{
$elapsedTime = microtime(true) - $this->_currentQuery['executionMS'];
$this->_totalElapsedTime += $elapsedTime;
++$this->_queryCount;
$labelTime = round($elapsedTime, 5);
$this->_message->addRow(array($labelTime, $this->_currentQuery['sql'], $this->_currentQuery['parameters']));
$this->_updateMessageLabel();
if (!is_null($this->_criticalQueriesLogger)) {
if ($labelTime >= self::DURATION_LIMIT) {
$query = $this->_currentQuery['sql'];
$params = $this->_currentQuery['parameters'];
$log = sprintf(PHP_EOL . 'TIME: %f' . PHP_EOL, $labelTime);
if (count($params) > 0) {
$queryWithParams = '';
$queryPieces = explode('?', $query);
foreach ($queryPieces as $key => $queryPiece) {
if (isset($params[$key])) {
if (is_numeric($params[$key]) || is_bool($params[$key])) {
$queryWithParams .= $params[$key];
} else {
$params[$key] = str_replace("'", "''", $params[$key]);
$queryWithParams .= "'{$params[$key]}'";
}
}
$queryWithParams .= $queryPiece;
}
$log .= sprintf('QUERY (WITH BOUND PARAMETERS):' . PHP_EOL . '%s' . PHP_EOL . PHP_EOL . 'QUERY (ORIGINAL):' . PHP_EOL . '%s' . PHP_EOL . PHP_EOL . 'BOUND PARAMETERS:' . PHP_EOL . '%s', $queryWithParams, $query, print_r($params, true));
} else {
$log .= sprintf('QUERY:' . PHP_EOL . '%s', $query);
}
$request = \Zend_Controller_Front::getInstance()->getRequest();
$log .= PHP_EOL . 'ROUTE: ';
$log .= $request->getModuleName();
$log .= '/' . $request->getControllerName();
$log .= '/' . $request->getActionName() . PHP_EOL;
$log .= PHP_EOL . PHP_EOL . '_______________________________________________________________________________';
$this->_criticalQueriesLogger->log($log, \Zend_Log::DEBUG);
}
}
}
示例12: display
/**
* Display profiling results and flush output buffer
*/
public function display()
{
$firebugMessage = new Zend_Wildfire_Plugin_FirePhp_TableMessage($this->_renderCaption());
$firebugMessage->setHeader(array_keys($this->_getColumns()));
foreach ($this->_getTimers() as $timerId) {
$row = array();
foreach ($this->_getColumns() as $columnId) {
$row[] = $this->_renderColumnValue($timerId, $columnId);
}
$firebugMessage->addRow($row);
}
Zend_Wildfire_Plugin_FirePhp::getInstance()->send($firebugMessage);
// setup the wildfire channel
$firebugChannel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
$firebugChannel->setRequest($this->_request ? $this->_request : new Zend_Controller_Request_Http());
$firebugChannel->setResponse($this->_response ? $this->_response : new Zend_Controller_Response_Http());
// flush the wildfire headers into the response object
$firebugChannel->flush();
// send the response headers
$firebugChannel->getResponse()->sendHeaders();
ob_end_flush();
}
示例13: log
public static function log($message, $levl = Zend_Log::INFO, $data = null)
{
if (Zend_Registry::isRegistered('logger')) {
$logger = Zend_Registry::get('logger');
/**
* прислали что то на вардамп
*/
if (null != $data) {
/**
*
* сделаем табличку
* @var unknown_type
*/
$_message = new Zend_Wildfire_Plugin_FirePhp_TableMessage($message);
$_message->setHeader(array('Data'));
$_message->addRow(array($data));
$logger->log($_message, $levl);
} else {
$logger->log($message, $levl, $extras);
}
}
}
示例14: getGenerateTime
/**
* getGenerateTime
*
* @param string $aComment
* @return string time
*/
public static function getGenerateTime($aComment = "")
{
if (!self::$_enabled) {
return;
}
$back = debug_backtrace();
$_time = microtime(true);
list($mTotal, $mSec) = self::getMemoryUsage();
if (!isset(self::$_time) && defined('START_TIMER')) {
self::$_time["start"] = START_TIMER;
self::$_time["section"] = START_TIMER;
}
if (!isset(self::$_time)) {
self::$_time["start"] = $_time;
self::$_time["section"] = $_time;
self::$_timer->addRow(array(sprintf("%01.4f", 0), sprintf("%01.4f", 0), $mSec, $mTotal, $aComment, basename(@$back[0]["file"]) . ':' . @$back[0]["line"]));
} else {
$start = self::$_time["section"];
self::$_time["section"] = $_time;
self::$_timer->addRow(array(sprintf("%01.4f", round(self::$_time["section"] - $start, 4)), sprintf("%01.4f", round(self::$_time["section"] - self::$_time["start"], 4)), $mSec, $mTotal, $aComment, basename(@$back[0]["file"]) . ':' . @$back[0]["line"]));
}
self::updateMessageLabel();
Zend_Wildfire_Plugin_FirePhp::getInstance()->send(self::$_timer);
}
示例15: _setProfiles
/**
* Constructs and send the profiles table.
*
* @param Zend_Wildfire_Plugin_FirePhp_TableMessage $profiles
* @return array Retrieves an array with the queries profiles
*/
private function _setProfiles(Zend_Wildfire_Plugin_FirePhp_TableMessage $profiles)
{
// Get the profiles
$db = Zend_Registry::get('db');
$sth = $db->query(self::DONT_PROFILE . 'show profiles');
$rows = $sth->fetchAll();
$queryIds = array();
foreach ($rows as $row) {
// Profile only queries marked as profile
if (!(strpos($row['Query'], self::DONT_PROFILE) === false)) {
continue;
}
$queryIds[] = $row['Query_ID'];
$values = array_values($row);
$profiles->addRow($values);
}
return $queryIds;
}