Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
555ff9dc
Commit
555ff9dc
authored
Jan 01, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1732 from Ragazzo/debug_module_config_panel_improvements
Debug module config panel improvements
parents
4b2ec855
05c230e2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
63 deletions
+73
-63
ConfigPanel.php
extensions/yii/debug/panels/ConfigPanel.php
+23
-63
_data_table.php
...ons/yii/debug/views/default/panels/config/_data_table.php
+25
-0
detail.php
extensions/yii/debug/views/default/panels/config/detail.php
+15
-0
summary.php
extensions/yii/debug/views/default/panels/config/summary.php
+10
-0
No files found.
extensions/yii/debug/panels/ConfigPanel.php
View file @
555ff9dc
...
...
@@ -9,7 +9,6 @@ namespace yii\debug\panels;
use
Yii
;
use
yii\debug\Panel
;
use
yii\helpers\Html
;
/**
* Debugger panel that collects and displays application configuration and environment.
...
...
@@ -31,79 +30,40 @@ class ConfigPanel extends Panel
public
function
getSummary
()
{
$yiiLogo
=
$this
->
getYiiLogo
();
$url
=
$this
->
getUrl
();
$phpUrl
=
Yii
::
$app
->
getUrlManager
()
->
createUrl
(
$this
->
module
->
id
.
'/default/phpinfo'
);
return
<<<EOD
<div class="yii-debug-toolbar-block">
<a href="$url">
<img width="29" height="30" alt="" src="$yiiLogo">
<span>{$this->data['application']['yii']}</span>
</a>
</div>
<div class="yii-debug-toolbar-block">
<a href="$phpUrl" title="Show phpinfo()">PHP {$this->data['php']['version']}</a>
</div>
EOD;
return
Yii
::
$app
->
view
->
render
(
'panels/config/summary'
,
[
'panel'
=>
$this
,
'data'
=>
$this
->
data
,
]);
}
public
function
getDetail
()
{
$app
=
[
'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
=
[
'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
->
renderExtensions
()
.
$this
->
renderData
(
'PHP Configuration'
,
$php
)
.
"
\n
"
.
$this
->
getPhpInfo
();
}
protected
function
getPhpInfo
()
{
return
'<div>'
.
Html
::
a
(
'Show phpinfo »'
,
[
'phpinfo'
],
[
'class'
=>
'btn btn-primary'
])
.
"</div>
\n
"
;
}
protected
function
renderData
(
$caption
,
$values
)
{
if
(
empty
(
$values
))
{
return
"<h3>
$caption
</h3>
\n
<p>Empty.</p>"
;
}
$rows
=
[];
foreach
(
$values
as
$name
=>
$value
)
{
$rows
[]
=
'<tr><th style="width:200px;">'
.
Html
::
encode
(
$name
)
.
'</th><td style="overflow:auto">'
.
Html
::
encode
(
$value
)
.
'</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;
return
Yii
::
$app
->
view
->
render
(
'panels/config/detail'
,
[
'panel'
=>
$this
,
'data'
=>
$this
->
data
,
'app'
=>
[
'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'
=>
[
'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'
,
],
'extensions'
=>
$this
->
getExtensions
(),
]);
}
p
rotected
function
render
Extensions
()
p
ublic
function
get
Extensions
()
{
if
(
empty
(
$this
->
data
[
'extensions'
]))
{
return
''
;
}
$data
=
[];
foreach
(
$this
->
data
[
'extensions'
]
as
$extension
)
{
$data
[
$extension
[
'name'
]]
=
$extension
[
'version'
];
}
return
$
this
->
renderData
(
'Installed Extensions'
,
$data
)
.
"
\n
"
;
return
$
data
;
}
public
function
save
()
...
...
extensions/yii/debug/views/default/panels/config/_data_table.php
0 → 100644
View file @
555ff9dc
<?php
use
yii\helpers\Html
;
if
(
empty
(
$values
))
:
?>
<h3>
<?php
echo
$caption
;
?>
</h3>
<p>
Empty.
</p>
<?php
else
:
?>
<h3>
<?php
echo
$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>
<?php
foreach
(
$values
as
$name
=>
$value
)
:
?>
<tr>
<th
style=
"width: 200px;"
>
<?php
echo
Html
::
encode
(
$name
);
?>
</th>
<td
style=
"overflow:auto"
>
<?php
echo
Html
::
encode
(
$value
);
?>
</td>
</tr>
<?php
endforeach
;
?>
</tbody>
</table>
<?php
endif
;
?>
\ No newline at end of file
extensions/yii/debug/views/default/panels/config/detail.php
0 → 100644
View file @
555ff9dc
<?php
use
yii\helpers\Html
;
?>
<h1>
Configuration
</h1>
<?php
echo
$this
->
context
->
renderPartial
(
'panels/config/_data_table'
,[
'caption'
=>
'Application Configuration'
,
'values'
=>
$app
]);
if
(
!
empty
(
$extensions
))
{
echo
$this
->
context
->
renderPartial
(
'panels/config/_data_table'
,[
'caption'
=>
'Installed Extensions'
,
'values'
=>
$extensions
]);
}
echo
$this
->
context
->
renderPartial
(
'panels/config/_data_table'
,[
'caption'
=>
'PHP Configuration'
,
'values'
=>
$php
]);
?>
<div>
<?php
echo
Html
::
a
(
'Show phpinfo »'
,
[
'phpinfo'
],
[
'class'
=>
'btn btn-primary'
]);
?>
</div>
\ No newline at end of file
extensions/yii/debug/views/default/panels/config/summary.php
0 → 100644
View file @
555ff9dc
<div
class=
"yii-debug-toolbar-block"
>
<a
href=
"
<?php
echo
$panel
->
getUrl
();
?>
"
>
<img
width=
"29"
height=
"30"
alt=
""
src=
"
<?php
echo
$panel
->
getYiiLogo
();
?>
"
>
<span>
<?php
echo
$data
[
'application'
][
'yii'
];
?>
</span>
</a>
</div>
<div
class=
"yii-debug-toolbar-block"
>
<a
href=
"
<?php
echo
$this
->
context
->
createUrl
(
'phpinfo'
);
?>
"
title=
"Show phpinfo()"
>
PHP
<?php
echo
$data
[
'php'
][
'version'
];
?>
</a>
</div>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment