-
Notifications
You must be signed in to change notification settings - Fork 566
Expand file tree
/
Copy pathrequest_panel.php
More file actions
121 lines (111 loc) · 3.44 KB
/
request_panel.php
File metadata and controls
121 lines (111 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
/**
* Request Panel Element
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link https://cakephp.org CakePHP(tm) Project
* @since DebugKit 0.1
* @license https://www.opensource.org/licenses/mit-license.php MIT License
*/
/**
* @var \DebugKit\View\AjaxView $this
* @var array $headers
* @var array $attributes
* @var \Cake\Error\Debug\NodeInterface $data
* @var \Cake\Error\Debug\NodeInterface $query
* @var \Cake\Error\Debug\NodeInterface $cookie
* @var string $matchedRoute
* @var array $params
*/
use Cake\Error\Debugger;
?>
<div class="c-request-panel">
<?php if (!empty($headers) && $headers['response']) : ?>
<h4>Warning</h4>
<p class="c-flash c-flash--warning">
<?= sprintf(
'Headers already sent at file %s and line %d.',
$headers['file'],
$headers['line']
) ?>
</p>
<?php endif; ?>
<h4>Route path</h4>
<?php
$routePath = $params['controller'] . '::' . $params['action'];
if (!empty($params['prefix'])) {
$routePath = $params['prefix'] . '/' . $routePath;
}
if (!empty($params['plugin'])) {
$routePath = $params['plugin'] . '.' . $routePath;
}
?>
<div class="cake-debug">
<code><?php echo h($routePath); ?></code>
</div>
<p>
<i class="o-help">Route path grammar: [Plugin].[Prefix]/[Controller]::[action]</i>
</p>
<h4>Attributes</h4>
<?php
if (empty($attributes)) :
echo '<p class="c-flash c-flash--info">No attributes data.</p>';
else :
echo $this->Toolbar->dumpNodes($attributes);
endif;
?>
<h4>Post data</h4>
<?php
if (empty($data)) :
echo '<p class="c-flash c-flash--info">No post data.</p>';
else :
echo $this->Toolbar->dumpNode($data);
endif;
?>
<h4>Query string</h4>
<?php
if (empty($query)) :
echo '<p class="c-flash c-flash--info">No querystring data.</p>';
else :
echo $this->Toolbar->dumpNode($query);
endif;
?>
<h4>Cookie</h4>
<?php if (isset($cookie)) : ?>
<?= $this->Toolbar->dumpNode($cookie) ?>
<?php else : ?>
<p class="c-flash c-flash--info">No Cookie data.</p>
<?php endif; ?>
<h4>Session</h4>
<?php if (isset($session)) : ?>
<p>
<button
class="o-button js-clear-session"
data-url="<?= $this->Url->build([
'plugin' => 'DebugKit',
'controller' => 'Toolbar',
'action' => 'clearSession',
]) ?>"
data-csrf="<?= $this->getRequest()->getAttribute('csrfToken') ?>"
>
Clear Session
</button>
</p>
<div class="c-request-panel__messages"></div>
<?= $this->Toolbar->dumpNode($session) ?>
<?php else : ?>
<p class="c-flash c-flash--info">No Session data.</p>
<?php endif; ?>
<?php if (!empty($matchedRoute)) : ?>
<h4>Matched Route</h4>
<p><?= $this->Toolbar->dumpNode(Debugger::exportVarAsNodes(['template' => $matchedRoute])) ?></p>
<?php endif; ?>
</div>