function RemoveDir($path) { if (file_exists($path) && is_dir($path)) { $dirHandle = opendir($path); while (false !== ($file = readdir($dirHandle))) { if ($file != '.' && $file != '..') { $tmpPath = $path . '/' . $file; chmod($tmpPath, 0777); if (is_dir($tmpPath)) { RemoveDir($tmpPath); } else { if (file_exists($tmpPath)) { unlink($tmpPath); } } } } closedir($dirHandle); if (file_exists($path)) { rmdir($path); } } else { throw new Exception(YiiDebug::t('Failed to delete folder.')); } }
/** * {@inheritdoc} */ public function getTitle() { if (false !== $this->_cache) { return YiiDebug::t('Cache requests'); } return YiiDebug::t('No cache usage'); }
/** * {@inheritdoc} */ public function run() { $resources = array(YiiDebug::t('Page Load Time') => sprintf('%0.3F s.', $this->getLoadTime()), YiiDebug::t('Elapsed Time') => sprintf('%0.3F s.', $this->getRequestLoadTime()), YiiDebug::t('Memory Usage') => number_format(Yii::getLogger()->getMemoryUsage() / 1024) . ' KB', YiiDebug::t('Memory Peak Usage') => number_format(memory_get_peak_usage() / 1024) . ' KB'); if (function_exists('mb_strlen') && isset($_SESSION)) { $resources[YiiDebug::t('Session Size')] = sprintf('%0.3F KB', mb_strlen(serialize($_SESSION)) / 1024); } $this->render('resource_usage', array('resources' => $resources)); }
/** * {@inheritdoc} */ public function run() { $resources = array(YiiDebug::t('Page Load Time') => sprintf('%0.6F s.', $this->getLoadTime()), YiiDebug::t('Elapsed Time') => sprintf('%0.6F s.', $this->getRequestLoadTime()), YiiDebug::t('Memory Usage') => number_format(Yii::getLogger()->getMemoryUsage() / 1024) . ' KB', YiiDebug::t('Memory Peak Usage') => function_exists('memory_get_peak_usage') ? number_format(memory_get_peak_usage() / 1024) . ' KB' : 'N/A'); if (function_exists('mb_strlen') && isset($_SESSION)) { $resources[YiiDebug::t('Session Size')] = sprintf('%0.3F KB', mb_strlen(serialize($_SESSION)) / 1024); } echo CHtml::openTag('div', $this->htmlOptions); echo CHtml::tag('h1', array(), $this->title); echo CHtml::openTag('ul', array('class' => 'data')); foreach ($resources as $key => $value) { echo CHtml::openTag('li'); echo CHtml::tag('label', array(), $key); echo CHtml::tag('span', array(), $value); echo CHtml::closeTag('li'); } echo CHtml::closeTag('ul'); echo CHtml::closeTag('div'); }
/** * {@inheritdoc} */ public function getTitle() { return YiiDebug::t('Request'); }
/** * Create panels. * * @return YiiDebugToolbar */ private function createPanels() { foreach ($this->getPanels() as $id => $config) { if (!is_object($config)) { if (is_string($config)) { $config = array('class' => $config); } if (is_array($config)) { if (is_array($config) && !isset($config['class'])) { $config['class'] = $id; } if (isset($config['enabled']) && false === $config['enabled']) { unset($this->_panels[$id]); continue; } else { if (isset($config['enabled']) && true === $config['enabled']) { unset($config['enabled']); } } } $panel = Yii::createComponent($config, $this); if (false === $panel instanceof YiiDebugToolbarPanelInterface) { throw new CException(YiiDebug::t('The %class% class must be compatible with YiiDebugToolbarPanelInterface', array('%class%' => get_class($panel)))); } $panel->init(); $this->_panels[$id] = $panel; } } return $this; }
/** * Initialization. */ public function init() { if (false === $this->owner instanceof CLogRoute) { throw new CException(YiiDebug::t('YiiDebugToolbar owner must be instance of CLogRoute')); } $this->createPanels()->registerClientScripts(); }
/** * Returns the DB server info by connection ID. * @param string $connectionId * @return mixed */ public function getServerInfo($connectionId) { if (null !== ($connection = Yii::app()->getComponent($connectionId)) && false !== $connection instanceof CDbConnection && !in_array($connection->driverName, array('sqlite', 'oci', 'dblib')) && '' !== ($serverInfo = $connection->getServerInfo())) { $info = array(YiiDebug::t('Driver') => $connection->getDriverName(), YiiDebug::t('Server Version') => $connection->getServerVersion()); $lines = explode(' ', $serverInfo); foreach ($lines as $line) { list($key, $value) = explode(': ', $line, 2); $info[YiiDebug::t($key)] = $value; } if (!empty($info[YiiDebug::t('Uptime')])) { $info[YiiDebug::t('Uptime')] = $this->duration($info[YiiDebug::t('Uptime')]); } return $info; } return null; }
<?php $this->widget('YiiDebugToolbarResourceUsage', array('title' => 'Resource usage', 'htmlOptions' => array('class' => 'panel'))); ?> </div> </div> <?php foreach ($panels as $panel) { ?> <div id="<?php echo $panel->id; ?> " class="yii-debug-toolbar-panel"> <div class="yii-debug-toolbar-panel-title"> <a href="#close" class="yii-debug-toolbar-panel-close"><?php echo YiiDebug::t('Close'); ?> </a> <h3> <?php echo CHtml::encode($panel->title); ?> <?php if ($panel->subTitle) { ?> <small><?php echo CHtml::encode($panel->subTitle); ?> </small> <?php }
</tbody> </table> <h4 class="collapsible"><?php echo YiiDebug::t('Components'); ?> </h4> <table> <thead> <tr> <th width="180"><?php echo YiiDebug::t('Component ID'); ?> </th> <th><?php echo YiiDebug::t('Configuration'); ?> </th> </tr> </thead> <tbody> <?php $c = 0; foreach ($components as $key => $value) { ?> <tr class="<?php echo $c % 2 ? 'odd' : 'even'; ?> "> <th><?php echo $key;
<div data-ydtb-tabs="<?php echo $this->id; ?> "> <ul> <li><a href="#cache-summary"><i data-ydtb-icon="s"></i><?php echo YiiDebug::t('Summary'); ?> </a></li> <li><a href="#cache-callstack"><i data-ydtb-icon="s"></i><?php echo YiiDebug::t('Callstack'); ?> </a></li> <li><a href="#cache-settings"><i data-ydtb-icon="s"></i><?php echo YiiDebug::t('Settings'); ?> </a></li> </ul> <div data-ydtb-panel-data="<?php echo $this->id; ?> "> <div> <div data-ydtb-tab="cache-settings"> <?php $this->render('cache/settings', array('settings' => $settings)); ?> </div> <div data-ydtb-tab="cache-summary"> <?php $this->render('cache/summary', array('summary' => $summary));
/** * Processing summary. * * @param array $logs Logs. * @return array */ protected function processSummary(array $logs) { if (empty($logs)) { return $logs; } $stack = array(); foreach ($logs as $log) { $message = $log[0]; if (0 === strncasecmp($message, 'begin:', 6)) { $log[0] = substr($message, 6); $stack[] = $log; } else { if (0 === strncasecmp($message, 'end:', 4)) { $token = substr($message, 4); if (null !== ($last = array_pop($stack)) && $last[0] === $token) { $delta = $log[3] - $last[3]; if (isset($results[$token])) { $results[$token] = $this->aggregateResult($results[$token], $delta); } else { $results[$token] = array($token, 1, $delta, $delta, $delta); } } else { throw new CException(YiiDebug::t('Mismatching code block "{token}". Make sure the calls to Yii::beginProfile() and Yii::endProfile() be properly nested.', array('{token}' => $token))); } } } } $now = microtime(true); while (null !== ($last = array_pop($stack))) { $delta = $now - $last[3]; $token = $last[0]; if (isset($results[$token])) { $results[$token] = $this->aggregateResult($results[$token], $delta); } else { $results[$token] = array($token, 1, $delta, $delta, $delta); } } $entries = array_values($results); $func = create_function('$a,$b', 'return $a[4]<$b[4]?1:0;'); usort($entries, $func); return array_map(array($this, 'formatLogEntry'), $entries); }
/** * {@inheritdoc} */ public function getTitle() { return YiiDebug::t('Log Messages'); }
/** * {@inheritdoc} */ public function getTitle() { return YiiDebug::t('Views Rendering'); }
</tr> <?php } ?> </tbody> </table> </div> </div> <div data-ydtb-accordion-group="collapsed"> <div data-ydtb-accordion-heading="" data-ydtb-data-size="<?php echo count($components); ?> "> <i data-ydtb-icon="s"></i> <span><?php echo YiiDebug::t('Components'); ?> </span> <i data-ydtb-icon="q"></i> <i data-ydtb-icon="t"></i> <div class="clear clearfix"></div> </div> <div data-ydtb-accordion-body=""> <table data-ydtb-data-table="fixed"> <tbody> <?php foreach ($components as $key => $value) { ?> <tr> <th><?php echo $key;
<?php } ?> </tbody> </table> <script type="text/javascript"> function deleteAsset(link, blockAll){ $.getJSON(link.href, {}, function(data){ if(data == 'ok'){ $(link).parents('tr').remove(); if(blockAll){ $('a.deleteAsset').remove(); } } if(data == 'notexists'){ alert('<?php echo YiiDebug::t('Path not found.'); ?> '); } if(data == 'unknow'){ alert('<?php echo YiiDebug::t('Unknow error.'); ?> '); } }); } </script>
<tr> <th class="collapsible collapsed al-l" rel="#yii-debug-toolbar-log .details"> <?php echo YiiDebug::t('Message (details)'); ?> </th> <th nowrap="nowrap"><?php echo YiiDebug::t('Level'); ?> </th> <th nowrap="nowrap" class="al-l"><?php echo YiiDebug::t('Category'); ?> </th> <th nowrap="nowrap"><?php echo YiiDebug::t('Time'); ?> </th> </tr> </thead> <tbody> <?php foreach ($logs as $id => $entry) { ?> <tr class="<?php echo $id % 2 ? 'odd' : 'even'; ?> " <?php if (isset($colors[$entry[1]])) { ?>
* * Description of application file * * @author Sergey Malyshev <*****@*****.**> * @version $Id$ * @package * @since 1.1.7 */ $index = 1; ?> <?php foreach ($data as $id => $item) { ?> <h4><?php echo YiiDebug::t('Context'); ?> <?php echo CHtml::encode(get_class($item['context'])); ?> </h4> <p class="collapsible collapsed"> <?php echo $this->getFileAlias($item['sourceFile']); ?> </p> <div> <table> <tbody> <tr class="<?php
/** * {@inheritdoc} */ public function getTitle() { return YiiDebug::t('Global Variables'); }
<?php if ($settings) { ?> <table data-ydtb-data-table="fixed"> <tbody> <?php foreach ($settings as $key => $value) { ?> <tr> <th><?php echo $key; ?> </th> <td><?php echo $this->dump($value); ?> </td> </tr> <?php } ?> </tbody> </table> <?php } else { ?> <?php echo YiiDebug::t('Cache not configured'); }
<?php if ($connections) { foreach ($connections as $id => $connection) { ?> <h2><?php echo YiiDebug::t('Connection ID'); ?> : <?php echo $id; ?> (<?php echo get_class($connection); ?> )</h2> <?php $serverInfo = $this->getServerInfo($id); ?> <table data-ydtb-data-table> <tbody> <?php if (is_array($serverInfo)) { ?> <?php foreach ($serverInfo as $param => $value) { ?> <tr> <th><?php echo CHtml::encode($param); ?> </th>
<div id="ydtb-toolbar" data-ydtb-toolbar class="ydtb-collapse"> <a href="javascript://" data-ydtb-toggle="[data-ydtb-toolbar]"><?php echo YiiDebug::t('TOOLBAR'); ?> </a> <div data-ydtb-sidebar> <h1>Yii <?php echo Yii::getVersion(); ?> </h1> <?php $this->widget('YiiDebugToolbarResourceUsage'); ?> <ul data-ydtb-menu> <?php foreach ($panels as $panel) { ?> <li><a href="javascript://" data-ydtb-expand-panel="<?php echo $panel->id; ?> "> <i data-ydtb-icon="<?php echo $panel->i; ?> "></i> <?php if (null !== $panel->menuSubTitle) { ?> <small><?php echo $panel->menuSubTitle; ?>
} ?> <h4 class="collapsible">SERVER <?php echo YiiDebug::t('Variables'); ?> </h4> <table id="debug-toolbar-globals-server"> <thead> <tr> <th><?php echo YiiDebug::t('Name'); ?> </th> <th><?php echo YiiDebug::t('Value'); ?> </th> </tr> </thead> <tbody> <?php $c = 0; foreach ($server as $key => $value) { ?> <tr class="<?php echo $c % 2 ? 'odd' : 'even'; ?> "> <th><?php echo $key;
/** * {@inheritdoc} */ public function getTitle() { return YiiDebug::t('Server Info'); }
<?php foreach ($files as $key => $value) { ?> <tr class="<?php echo $c % 2 ? 'odd' : 'even'; ?> "> <th><?php echo $key; ?> </th> <td><?php echo $this->dump($value); ?> </td> </tr> <?php ++$c; } ?> </tbody> </table> <?php } else { ?> <h4>FILES</h4> <?php echo YiiDebug::t('No FILES data'); ?> <?php }
<?php /** * @var $this YiiDebugToolbarPanelVarDumper */ foreach ($this->getLogs() as $category => $categoryLogs) { $c = 0; echo CHtml::tag('h4', array('class' => 'collapsible'), $category); echo CHtml::openTag('table'); echo CHtml::openTag('thead'); echo CHtml::openTag('tr'); echo CHtml::tag('th', array(), YiiDebug::t('Value')); echo CHtml::tag('th', array('width' => '10%'), YiiDebug::t('Time')); echo CHtml::closeTag('tr'); echo CHtml::closeTag('thead'); echo CHtml::openTag('tbody'); foreach ($categoryLogs as $log) { echo CHtml::openTag('tr', array('class' => $c % 2 ? 'odd' : 'even')); echo CHtml::tag('td', array(), $log[0]); echo CHtml::tag('td', array(), date('H:i:s.', $log[3]) . sprintf('%06d', (int) (($log[3] - (int) $log[3]) * 1000000))); echo CHtml::closeTag('tr'); $c++; } echo CHtml::closeTag('tbody'); echo CHtml::closeTag('table'); }
echo $summary['delete']; ?> </td> <td><?php printf('%0.6F', $summary['delete_time']); ?> s</td> </tr> <tr> <th>flush</th> <td><?php echo $summary['flush']; ?> </td> <td><?php printf('%0.6F', $summary['flush_time']); ?> s</td> </tr> </tbody> </table> <?php } else { ?> <p> <?php echo YiiDebug::t('No cache request logged or profiling the cache is DISABLED.'); ?> </p> <?php }
public function getTitle() { return YiiDebug::t('Application Settings'); }
public function getTitle() { return YiiDebug::t('VarDumper output'); }
/** * {@inheritdoc} */ public function getTitle() { return YiiDebug::t('Views Rendering ({count} rendered)', array('{count}' => $this->viewsCount)); }