You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

101 lines
11 KiB

<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\panels;
use Yii;
use yii\debug\Panel;
use yii\helpers\Html;
/**
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class ConfigPanel extends Panel
{
public function getName()
{
return 'Configuration';
}
public function getSummary()
{
$yiiLogo = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAeCAYAAADQBxWhAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUK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AAAAAAAAAAAAAAAAAAAAAAAAAAEAAP//vNz1LVdvDhUAAAAASUVORK5CYII=';
return <<<EOD
<div class="yii-debug-toolbar-block">
<a href="http://www.yiiframework.com/" title="Yii Framework">
<img width="29" height="30" alt="" src="$yiiLogo">
<span>{$this->data['application']['yii']}</span>
</a>
</div>
<div class="yii-debug-toolbar-block">
PHP {$this->data['php']['version']}
</div>
EOD;
}
public function getDetail()
{
$app = array(
'Yii Version' => $this->data['application']['yii'],
'Application Name' => $this->data['application']['name'],
'Environment' => $this->data['application']['env'],
'Debug Mode' => $this->data['application']['debug'] ? 'Yes' : 'No',
);
$php = array(
'PHP Version' => $this->data['php']['version'],
'Xdebug' => $this->data['php']['xdebug'] ? 'Enabled' : 'Disabled',
'APC' => $this->data['php']['apc'] ? 'Enabled' : 'Disabled',
'Memcache' => $this->data['php']['memcache'] ? 'Enabled' : 'Disabled',
);
return "<h1>Configuration</h1>\n"
. $this->renderData('Application Configuration', $app) . "\n"
. $this->renderData('PHP Configuration', $php) . "\n"
. '<div>' . Html::a('Complete phpinfo()', array('phpinfo'), array('class' => 'btn btn-info')) . "</div>\n";
}
protected function renderData($caption, $values)
{
if (empty($values)) {
return "<h3>$caption</h3>\n<p>Empty.</p>";
}
$rows = array();
foreach ($values as $name => $value) {
$rows[] = '<tr><th style="width: 200px;">' . Html::encode($name) . '</th><td><div style="overflow:auto">' . Html::encode($value) . '</div></td></tr>';
}
$rows = implode("\n", $rows);
return <<<EOD
<h3>$caption</h3>
<table class="table table-condensed table-bordered table-striped table-hover" style="table-layout: fixed;">
<thead><tr><th style="width: 200px;">Name</th><th>Value</th></tr></thead>
<tbody>
$rows
</tbody>
</table>
EOD;
}
public function save()
{
return array(
'phpVersion' => PHP_VERSION,
'yiiVersion' => Yii::getVersion(),
'application' => array(
'yii' => Yii::getVersion(),
'name' => Yii::$app->name,
'env' => YII_ENV,
'debug' => YII_DEBUG,
),
'php' => array(
'version' => PHP_VERSION,
'xdebug' => extension_loaded('xdebug'),
'apc' => extension_loaded('apc'),
'memcache' => extension_loaded('memcache'),
),
);
}
}