| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
class sfWebDebugPanelConfig extends sfWebDebugPanel |
|---|
| 20 |
{ |
|---|
| 21 |
public function getTitle() |
|---|
| 22 |
{ |
|---|
| 23 |
return '<img src="'.$this->webDebug->getOption('image_root_path').'/config.png" alt="Config" /> config'; |
|---|
| 24 |
} |
|---|
| 25 |
|
|---|
| 26 |
public function getPanelTitle() |
|---|
| 27 |
{ |
|---|
| 28 |
return 'Configuration'; |
|---|
| 29 |
} |
|---|
| 30 |
|
|---|
| 31 |
public function getPanelContent() |
|---|
| 32 |
{ |
|---|
| 33 |
$config = array( |
|---|
| 34 |
'debug' => sfConfig::get('sf_debug') ? 'on' : 'off', |
|---|
| 35 |
'xdebug' => extension_loaded('xdebug') ? 'on' : 'off', |
|---|
| 36 |
'logging' => sfConfig::get('sf_logging_enabled') ? 'on' : 'off', |
|---|
| 37 |
'cache' => sfConfig::get('sf_cache') ? 'on' : 'off', |
|---|
| 38 |
'compression' => sfConfig::get('sf_compressed') ? 'on' : 'off', |
|---|
| 39 |
'tokenizer' => function_exists('token_get_all') ? 'on' : 'off', |
|---|
| 40 |
'eaccelerator' => extension_loaded('eaccelerator') && ini_get('eaccelerator.enable') ? 'on' : 'off', |
|---|
| 41 |
'apc' => extension_loaded('apc') && ini_get('apc.enabled') ? 'on' : 'off', |
|---|
| 42 |
'xcache' => extension_loaded('xcache') && ini_get('xcache.cacher') ? 'on' : 'off', |
|---|
| 43 |
); |
|---|
| 44 |
|
|---|
| 45 |
$html = '<ul id="sfWebDebugConfigSummary">'; |
|---|
| 46 |
foreach ($config as $key => $value) |
|---|
| 47 |
{ |
|---|
| 48 |
$html .= '<li class="is'.$value.($key == 'xcache' ? ' last' : '').'">'.$key.'</li>'; |
|---|
| 49 |
} |
|---|
| 50 |
$html .= '</ul>'; |
|---|
| 51 |
|
|---|
| 52 |
$context = sfContext::getInstance(); |
|---|
| 53 |
$html .= $this->formatArrayAsHtml('request', sfDebug::requestAsArray($context->getRequest())); |
|---|
| 54 |
$html .= $this->formatArrayAsHtml('response', sfDebug::responseAsArray($context->getResponse())); |
|---|
| 55 |
$html .= $this->formatArrayAsHtml('user', sfDebug::userAsArray($context->getUser())); |
|---|
| 56 |
$html .= $this->formatArrayAsHtml('settings', sfDebug::settingsAsArray()); |
|---|
| 57 |
$html .= $this->formatArrayAsHtml('globals', sfDebug::globalsAsArray()); |
|---|
| 58 |
$html .= $this->formatArrayAsHtml('php', sfDebug::phpInfoAsArray()); |
|---|
| 59 |
$html .= $this->formatArrayAsHtml('symfony', sfDebug::symfonyInfoAsArray()); |
|---|
| 60 |
|
|---|
| 61 |
return $html; |
|---|
| 62 |
} |
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
* Converts an array to HTML. |
|---|
| 66 |
* |
|---|
| 67 |
* @param string $id The identifier to use |
|---|
| 68 |
* @param array $values The array of values |
|---|
| 69 |
* |
|---|
| 70 |
* @return string An HTML string |
|---|
| 71 |
*/ |
|---|
| 72 |
protected function formatArrayAsHtml($id, $values) |
|---|
| 73 |
{ |
|---|
| 74 |
$id = ucfirst(strtolower($id)); |
|---|
| 75 |
|
|---|
| 76 |
return ' |
|---|
| 77 |
<h2>'.$id.' '.$this->getToggler('sfWebDebug'.$id).'</h2> |
|---|
| 78 |
<div id="sfWebDebug'.$id.'" style="display: none"><pre>'.htmlspecialchars(sfYaml::dump(sfDebug::removeObjects($values)), ENT_QUOTES, sfConfig::get('sf_charset')).'</pre></div> |
|---|
| 79 |
'; |
|---|
| 80 |
} |
|---|
| 81 |
} |
|---|
| 82 |
|
|---|