|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Kint\Renderer; |
|
4
|
|
|
|
|
5
|
|
|
use Kint\Kint; |
|
6
|
|
|
use Kint\Object\BasicObject; |
|
7
|
|
|
use Kint\Object\BlobObject; |
|
8
|
|
|
use Kint\Object\InstanceObject; |
|
9
|
|
|
use Kint\Object\Representation\Representation; |
|
10
|
|
|
|
|
11
|
|
|
class RichRenderer extends Renderer |
|
|
|
|
|
|
12
|
|
|
{ |
|
13
|
|
|
/** |
|
14
|
|
|
* RichRenderer object plugins should implement Kint\Renderer\Rich\ObjectPluginInterface. |
|
15
|
|
|
*/ |
|
16
|
|
|
public static $object_plugins = array( |
|
|
|
|
|
|
17
|
|
|
'blacklist' => 'Kint\\Renderer\\Rich\\BlacklistPlugin', |
|
18
|
|
|
'callable' => 'Kint\\Renderer\\Rich\\CallablePlugin', |
|
19
|
|
|
'closure' => 'Kint\\Renderer\\Rich\\ClosurePlugin', |
|
20
|
|
|
'color' => 'Kint\\Renderer\\Rich\\ColorPlugin', |
|
21
|
|
|
'depth_limit' => 'Kint\\Renderer\\Rich\\DepthLimitPlugin', |
|
22
|
|
|
'nothing' => 'Kint\\Renderer\\Rich\\NothingPlugin', |
|
23
|
|
|
'recursion' => 'Kint\\Renderer\\Rich\\RecursionPlugin', |
|
24
|
|
|
'simplexml_element' => 'Kint\\Renderer\\Rich\\SimpleXMLElementPlugin', |
|
25
|
|
|
'trace_frame' => 'Kint\\Renderer\\Rich\\TraceFramePlugin', |
|
26
|
|
|
); |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* RichRenderer tab plugins should implement Kint\Renderer\Rich\TabPluginInterface. |
|
30
|
|
|
*/ |
|
31
|
|
|
public static $tab_plugins = array( |
|
|
|
|
|
|
32
|
|
|
'binary' => 'Kint\\Renderer\\Rich\\BinaryPlugin', |
|
33
|
|
|
'color' => 'Kint\\Renderer\\Rich\\ColorPlugin', |
|
34
|
|
|
'docstring' => 'Kint\\Renderer\\Rich\\DocstringPlugin', |
|
35
|
|
|
'microtime' => 'Kint\\Renderer\\Rich\\MicrotimePlugin', |
|
36
|
|
|
'source' => 'Kint\\Renderer\\Rich\\SourcePlugin', |
|
37
|
|
|
'table' => 'Kint\\Renderer\\Rich\\TablePlugin', |
|
38
|
|
|
'timestamp' => 'Kint\\Renderer\\Rich\\TimestampPlugin', |
|
39
|
|
|
); |
|
40
|
|
|
|
|
41
|
|
|
public static $pre_render_sources = array( |
|
|
|
|
|
|
42
|
|
|
'script' => array( |
|
43
|
|
|
array('Kint\\Renderer\\RichRenderer', 'renderJs'), |
|
44
|
|
|
array('Kint\\Renderer\\Rich\\MicrotimePlugin', 'renderJs'), |
|
45
|
|
|
), |
|
46
|
|
|
'style' => array( |
|
47
|
|
|
array('Kint\\Renderer\\RichRenderer', 'renderCss'), |
|
48
|
|
|
), |
|
49
|
|
|
'raw' => array( |
|
50
|
|
|
array('Kint\\Renderer\\RichRenderer', 'renderFolder'), |
|
51
|
|
|
), |
|
52
|
|
|
); |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Whether or not to render access paths. |
|
56
|
|
|
* |
|
57
|
|
|
* Access paths can become incredibly heavy with very deep and wide |
|
58
|
|
|
* structures. Given mostly public variables it will typically make |
|
59
|
|
|
* up one quarter of the output HTML size. |
|
60
|
|
|
* |
|
61
|
|
|
* If this is an unacceptably large amount and your browser is groaning |
|
62
|
|
|
* under the weight of the access paths - your first order of buisiness |
|
63
|
|
|
* should be to get a new browser. Failing that, use this to turn them off. |
|
64
|
|
|
* |
|
65
|
|
|
* @var bool |
|
66
|
|
|
*/ |
|
67
|
|
|
public static $access_paths = true; |
|
|
|
|
|
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* The maximum length of a string before it is truncated. |
|
71
|
|
|
* |
|
72
|
|
|
* Falsey to disable |
|
73
|
|
|
* |
|
74
|
|
|
* @var int |
|
75
|
|
|
*/ |
|
76
|
|
|
public static $strlen_max = 80; |
|
|
|
|
|
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Path to the CSS file to load by default. |
|
80
|
|
|
* |
|
81
|
|
|
* @var string |
|
82
|
|
|
*/ |
|
83
|
|
|
public static $theme = 'original.css'; |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* Assume types and sizes don't need to be escaped. |
|
87
|
|
|
* |
|
88
|
|
|
* Turn this off if you use anything but ascii in your class names, |
|
89
|
|
|
* but it'll cause a slowdown of around 10% |
|
90
|
|
|
* |
|
91
|
|
|
* @var bool |
|
92
|
|
|
*/ |
|
93
|
|
|
public static $escape_types = false; |
|
|
|
|
|
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* Move all dumps to a folder at the bottom of the body. |
|
97
|
|
|
* |
|
98
|
|
|
* @var bool |
|
99
|
|
|
*/ |
|
100
|
|
|
public static $folder = true; |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* Sort mode for object properties. |
|
104
|
|
|
* |
|
105
|
|
|
* @var int |
|
106
|
|
|
*/ |
|
107
|
|
|
public static $sort = self::SORT_NONE; |
|
108
|
|
|
|
|
109
|
|
|
protected static $been_run = false; |
|
|
|
|
|
|
110
|
|
|
|
|
111
|
|
|
protected $plugin_objs = array(); |
|
|
|
|
|
|
112
|
|
|
protected $mod_return = false; |
|
|
|
|
|
|
113
|
|
|
protected $callee; |
|
114
|
|
|
protected $mini_trace; |
|
|
|
|
|
|
115
|
|
|
protected $previous_caller; |
|
|
|
|
|
|
116
|
|
|
protected $file_link_format = false; |
|
|
|
|
|
|
117
|
|
|
protected $show_minitrace = true; |
|
|
|
|
|
|
118
|
|
|
protected $auto_expand = false; |
|
|
|
|
|
|
119
|
|
|
|
|
120
|
|
|
public function __construct(array $params = array()) |
|
121
|
|
|
{ |
|
122
|
|
|
parent::__construct($params); |
|
123
|
|
|
|
|
124
|
|
|
$params += array( |
|
125
|
|
|
'modifiers' => array(), |
|
126
|
|
|
'minitrace' => array(), |
|
127
|
|
|
'callee' => null, |
|
128
|
|
|
'caller' => null, |
|
129
|
|
|
); |
|
130
|
|
|
|
|
131
|
|
|
$this->callee = $params['callee']; |
|
132
|
|
|
$this->mini_trace = $params['minitrace']; |
|
133
|
|
|
$this->previous_caller = $params['caller']; |
|
134
|
|
|
|
|
135
|
|
|
if (isset($params['settings']['return'])) { |
|
136
|
|
|
$this->mod_return = $params['settings']['return']; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
if (isset($params['settings']['file_link_format'])) { |
|
140
|
|
|
$this->file_link_format = $params['settings']['file_link_format']; |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
if (empty($params['settings']['display_called_from'])) { |
|
144
|
|
|
$this->show_minitrace = false; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
if (!empty($params['settings']['expanded'])) { |
|
148
|
|
|
$this->auto_expand = true; |
|
149
|
|
|
} |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
public function render(BasicObject $o) |
|
|
|
|
|
|
153
|
|
|
{ |
|
154
|
|
|
if ($plugin = $this->getPlugin(self::$object_plugins, $o->hints)) { |
|
155
|
|
|
if (strlen($output = $plugin->renderObject($o))) { |
|
156
|
|
|
return $output; |
|
157
|
|
|
} |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
$children = $this->renderChildren($o); |
|
161
|
|
|
$header = $this->renderHeaderWrapper($o, (bool) strlen($children), $this->renderHeader($o)); |
|
162
|
|
|
|
|
163
|
|
|
return '<dl>'.$header.$children.'</dl>'; |
|
164
|
|
|
} |
|
165
|
|
|
|
|
166
|
|
|
public function renderHeaderWrapper(BasicObject $o, $has_children, $contents) |
|
|
|
|
|
|
167
|
|
|
{ |
|
168
|
|
|
$out = '<dt'; |
|
169
|
|
|
|
|
170
|
|
|
if ($has_children) { |
|
|
|
|
|
|
171
|
|
|
$out .= ' class="kint-parent'; |
|
172
|
|
|
|
|
173
|
|
|
if ($this->auto_expand) { |
|
174
|
|
|
$out .= ' kint-show'; |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
$out .= '"'; |
|
178
|
|
|
} |
|
179
|
|
|
|
|
180
|
|
|
$out .= '>'; |
|
181
|
|
|
|
|
182
|
|
View Code Duplication |
if (self::$access_paths && $o->depth > 0 && $ap = $o->getAccessPath()) { |
|
|
|
|
|
|
183
|
|
|
$out .= '<span class="kint-access-path-trigger" title="Show access path">⇄</span>'; |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
if ($has_children) { |
|
|
|
|
|
|
187
|
|
|
$out .= '<span class="kint-popup-trigger" title="Open in new window">⧉</span><nav></nav>'; |
|
188
|
|
|
} |
|
189
|
|
|
|
|
190
|
|
|
$out .= $contents; |
|
191
|
|
|
|
|
192
|
|
|
if (!empty($ap)) { |
|
193
|
|
|
$out .= '<div class="access-path">'.$this->escape($ap).'</div>'; |
|
194
|
|
|
} |
|
195
|
|
|
|
|
196
|
|
|
return $out.'</dt>'; |
|
197
|
|
|
} |
|
198
|
|
|
|
|
199
|
|
|
public function renderHeader(BasicObject $o) |
|
|
|
|
|
|
200
|
|
|
{ |
|
201
|
|
|
$output = ''; |
|
202
|
|
|
|
|
203
|
|
|
if (($s = $o->getModifiers()) !== null) { |
|
|
|
|
|
|
204
|
|
|
$output .= '<var>'.$s.'</var> '; |
|
205
|
|
|
} |
|
206
|
|
|
|
|
207
|
|
|
if (($s = $o->getName()) !== null) { |
|
208
|
|
|
$output .= '<dfn>'.$this->escape($s).'</dfn> '; |
|
209
|
|
|
|
|
210
|
|
|
if ($s = $o->getOperator()) { |
|
211
|
|
|
$output .= $this->escape($s, 'ASCII').' '; |
|
|
|
|
|
|
212
|
|
|
} |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
View Code Duplication |
if (($s = $o->getType()) !== null) { |
|
|
|
|
|
|
216
|
|
|
if (self::$escape_types) { |
|
217
|
|
|
$s = $this->escape($s); |
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
|
|
if ($o->reference) { |
|
221
|
|
|
$s = '&'.$s; |
|
222
|
|
|
} |
|
223
|
|
|
|
|
224
|
|
|
$output .= '<var>'.$s.'</var> '; |
|
225
|
|
|
} |
|
226
|
|
|
|
|
227
|
|
View Code Duplication |
if (($s = $o->getSize()) !== null) { |
|
|
|
|
|
|
228
|
|
|
if (self::$escape_types) { |
|
229
|
|
|
$s = $this->escape($s); |
|
230
|
|
|
} |
|
231
|
|
|
$output .= '('.$s.') '; |
|
232
|
|
|
} |
|
233
|
|
|
|
|
234
|
|
|
if (($s = $o->getValueShort()) !== null) { |
|
235
|
|
|
$s = preg_replace('/\s+/', ' ', $s); |
|
236
|
|
|
|
|
237
|
|
|
if (self::$strlen_max && BlobObject::strlen($s) > self::$strlen_max) { |
|
238
|
|
|
$s = substr($s, 0, self::$strlen_max).'...'; |
|
239
|
|
|
} |
|
240
|
|
|
$output .= $this->escape($s); |
|
241
|
|
|
} |
|
242
|
|
|
|
|
243
|
|
|
return trim($output); |
|
244
|
|
|
} |
|
245
|
|
|
|
|
246
|
|
|
public function renderChildren(BasicObject $o) |
|
|
|
|
|
|
247
|
|
|
{ |
|
248
|
|
|
$contents = array(); |
|
249
|
|
|
$tabs = array(); |
|
250
|
|
|
|
|
251
|
|
|
foreach ($o->getRepresentations() as $rep) { |
|
252
|
|
|
$result = $this->renderTab($o, $rep); |
|
253
|
|
|
if (strlen($result)) { |
|
254
|
|
|
$contents[] = $result; |
|
255
|
|
|
$tabs[] = $rep; |
|
256
|
|
|
} |
|
257
|
|
|
} |
|
258
|
|
|
|
|
259
|
|
|
if (empty($tabs)) { |
|
260
|
|
|
return ''; |
|
261
|
|
|
} |
|
262
|
|
|
|
|
263
|
|
|
$output = '<dd>'; |
|
264
|
|
|
|
|
265
|
|
|
if (count($tabs) === 1 && $tabs[0]->labelIsImplicit()) { |
|
266
|
|
|
$output .= reset($contents); |
|
267
|
|
|
} else { |
|
268
|
|
|
$output .= '<ul class="kint-tabs">'; |
|
269
|
|
|
|
|
270
|
|
|
foreach ($tabs as $i => $tab) { |
|
271
|
|
|
if ($i === 0) { |
|
272
|
|
|
$output .= '<li class="kint-active-tab">'; |
|
273
|
|
|
} else { |
|
274
|
|
|
$output .= '<li>'; |
|
275
|
|
|
} |
|
276
|
|
|
|
|
277
|
|
|
$output .= $this->escape($tab->getLabel()).'</li>'; |
|
278
|
|
|
} |
|
279
|
|
|
|
|
280
|
|
|
$output .= '</ul><ul>'; |
|
281
|
|
|
|
|
282
|
|
|
foreach ($contents as $tab) { |
|
283
|
|
|
$output .= '<li>'.$tab.'</li>'; |
|
284
|
|
|
} |
|
285
|
|
|
|
|
286
|
|
|
$output .= '</ul>'; |
|
287
|
|
|
} |
|
288
|
|
|
|
|
289
|
|
|
return $output.'</dd>'; |
|
290
|
|
|
} |
|
291
|
|
|
|
|
292
|
|
|
protected function renderTab(BasicObject $o, Representation $rep) |
|
|
|
|
|
|
293
|
|
|
{ |
|
294
|
|
|
if ($plugin = $this->getPlugin(self::$tab_plugins, $rep->hints)) { |
|
295
|
|
|
if (strlen($output = $plugin->renderTab($rep))) { |
|
296
|
|
|
return $output; |
|
297
|
|
|
} |
|
298
|
|
|
} |
|
299
|
|
|
|
|
300
|
|
|
if (is_array($rep->contents)) { |
|
301
|
|
|
$output = ''; |
|
302
|
|
|
|
|
303
|
|
View Code Duplication |
if ($o instanceof InstanceObject && $rep->getName() === 'properties') { |
|
|
|
|
|
|
304
|
|
|
foreach (self::sortProperties($rep->contents, self::$sort) as $obj) { |
|
305
|
|
|
$output .= $this->render($obj); |
|
306
|
|
|
} |
|
307
|
|
|
} else { |
|
308
|
|
|
foreach ($rep->contents as $obj) { |
|
309
|
|
|
$output .= $this->render($obj); |
|
310
|
|
|
} |
|
311
|
|
|
} |
|
312
|
|
|
|
|
313
|
|
|
return $output; |
|
314
|
|
|
} elseif (is_string($rep->contents)) { |
|
315
|
|
|
$show_contents = false; |
|
|
|
|
|
|
316
|
|
|
|
|
317
|
|
|
// If it is the value representation of a string and its whitespace |
|
318
|
|
|
// was truncated in the header, always display the full string |
|
319
|
|
|
if ($o->type !== 'string' || $o->value !== $rep) { |
|
320
|
|
|
$show_contents = true; |
|
|
|
|
|
|
321
|
|
|
} else { |
|
322
|
|
|
if (preg_match('/(:?[\r\n\t\f\v]| {2})/', $rep->contents)) { |
|
323
|
|
|
$show_contents = true; |
|
|
|
|
|
|
324
|
|
|
} elseif (self::$strlen_max && BlobObject::strlen($o->getValueShort()) > self::$strlen_max) { |
|
325
|
|
|
$show_contents = true; |
|
|
|
|
|
|
326
|
|
|
} |
|
327
|
|
|
|
|
328
|
|
|
if (empty($o->encoding)) { |
|
|
|
|
|
|
329
|
|
|
$show_contents = false; |
|
|
|
|
|
|
330
|
|
|
} |
|
331
|
|
|
} |
|
332
|
|
|
|
|
333
|
|
|
if ($show_contents) { |
|
|
|
|
|
|
334
|
|
|
return '<pre>'.$this->escape($rep->contents)."\n</pre>"; |
|
335
|
|
|
} |
|
336
|
|
|
} elseif ($rep->contents instanceof BasicObject) { |
|
337
|
|
|
return $this->render($rep->contents); |
|
338
|
|
|
} |
|
339
|
|
|
|
|
340
|
|
|
return; |
|
341
|
|
|
} |
|
342
|
|
|
|
|
343
|
|
|
protected static function renderJs() |
|
344
|
|
|
{ |
|
345
|
|
|
return file_get_contents(KINT_DIR.'/resources/compiled/rich.js'); |
|
346
|
|
|
} |
|
347
|
|
|
|
|
348
|
|
View Code Duplication |
protected static function renderCss() |
|
|
|
|
|
|
349
|
|
|
{ |
|
350
|
|
|
if (file_exists(KINT_DIR.'/resources/compiled/'.self::$theme)) { |
|
351
|
|
|
return file_get_contents(KINT_DIR.'/resources/compiled/'.self::$theme); |
|
352
|
|
|
} else { |
|
353
|
|
|
return file_get_contents(self::$theme); |
|
354
|
|
|
} |
|
355
|
|
|
} |
|
356
|
|
|
|
|
357
|
|
|
protected static function renderFolder() |
|
358
|
|
|
{ |
|
359
|
|
|
if (self::$folder) { |
|
360
|
|
|
return '<div class="kint-rich kint-folder"><dl><dt class="kint-parent"><nav></nav>Kint</dt><dd class="kint-folder"></dd></dl></div>'; |
|
361
|
|
|
} else { |
|
362
|
|
|
return ''; |
|
363
|
|
|
} |
|
364
|
|
|
} |
|
365
|
|
|
|
|
366
|
|
View Code Duplication |
public function preRender() |
|
|
|
|
|
|
367
|
|
|
{ |
|
368
|
|
|
$output = ''; |
|
369
|
|
|
|
|
370
|
|
|
if (!self::$been_run || $this->mod_return) { |
|
371
|
|
|
foreach (self::$pre_render_sources as $type => $values) { |
|
372
|
|
|
$contents = ''; |
|
373
|
|
|
foreach ($values as $v) { |
|
374
|
|
|
$contents .= call_user_func($v, $this); |
|
375
|
|
|
} |
|
376
|
|
|
|
|
377
|
|
|
if (!strlen($contents)) { |
|
378
|
|
|
continue; |
|
379
|
|
|
} |
|
380
|
|
|
|
|
381
|
|
|
switch ($type) { |
|
382
|
|
|
case 'script': |
|
383
|
|
|
$output .= '<script class="kint-script">'.$contents.'</script>'; |
|
384
|
|
|
break; |
|
385
|
|
|
case 'style': |
|
386
|
|
|
$output .= '<style class="kint-style">'.$contents.'</style>'; |
|
387
|
|
|
break; |
|
388
|
|
|
default: |
|
389
|
|
|
$output .= $contents; |
|
390
|
|
|
} |
|
391
|
|
|
} |
|
392
|
|
|
|
|
393
|
|
|
if (!$this->mod_return) { |
|
394
|
|
|
self::$been_run = true; |
|
395
|
|
|
} |
|
396
|
|
|
} |
|
397
|
|
|
|
|
398
|
|
|
return $output.'<div class="kint-rich">'; |
|
399
|
|
|
} |
|
400
|
|
|
|
|
401
|
|
|
public function postRender() |
|
402
|
|
|
{ |
|
403
|
|
|
if (!$this->show_minitrace) { |
|
404
|
|
|
return '</div>'; |
|
405
|
|
|
} |
|
406
|
|
|
|
|
407
|
|
|
$output = '<footer>'; |
|
408
|
|
|
$output .= '<span class="kint-popup-trigger" title="Open in new window">⧉</span> '; |
|
409
|
|
|
|
|
410
|
|
|
if (isset($this->callee['file'])) { |
|
411
|
|
|
if (!empty($this->mini_trace)) { |
|
412
|
|
|
$output .= '<nav></nav>'; |
|
413
|
|
|
} |
|
414
|
|
|
|
|
415
|
|
|
$output .= 'Called from '.$this->ideLink($this->callee['file'], $this->callee['line']); |
|
416
|
|
|
} |
|
417
|
|
|
|
|
418
|
|
|
$caller = ''; |
|
419
|
|
|
|
|
420
|
|
|
if (isset($this->previous_caller['class'])) { |
|
421
|
|
|
$caller .= $this->previous_caller['class']; |
|
422
|
|
|
} |
|
423
|
|
|
if (isset($this->previous_caller['type'])) { |
|
424
|
|
|
$caller .= $this->previous_caller['type']; |
|
425
|
|
|
} |
|
426
|
|
View Code Duplication |
if (isset($this->previous_caller['function']) |
|
|
|
|
|
|
427
|
|
|
&& !in_array( |
|
428
|
|
|
$this->previous_caller['function'], |
|
429
|
|
|
array('include', 'include_once', 'require', 'require_once') |
|
430
|
|
|
) |
|
431
|
|
|
) { |
|
432
|
|
|
$caller .= $this->previous_caller['function'].'()'; |
|
433
|
|
|
} |
|
434
|
|
|
|
|
435
|
|
|
if ($caller) { |
|
436
|
|
|
$output .= ' ['.$caller.']'; |
|
437
|
|
|
} |
|
438
|
|
|
|
|
439
|
|
|
if (!empty($this->mini_trace)) { |
|
440
|
|
|
$output .= '<ol>'; |
|
441
|
|
|
foreach ($this->mini_trace as $step) { |
|
442
|
|
|
$output .= '<li>'.$this->ideLink($step['file'], $step['line']); // closing tag not required |
|
443
|
|
|
if (isset($step['function']) |
|
444
|
|
|
&& !in_array($step['function'], array('include', 'include_once', 'require', 'require_once')) |
|
445
|
|
|
) { |
|
446
|
|
|
$output .= ' ['; |
|
447
|
|
|
if (isset($step['class'])) { |
|
448
|
|
|
$output .= $step['class']; |
|
449
|
|
|
} |
|
450
|
|
|
if (isset($step['type'])) { |
|
451
|
|
|
$output .= $step['type']; |
|
452
|
|
|
} |
|
453
|
|
|
$output .= $step['function'].'()]'; |
|
454
|
|
|
} |
|
455
|
|
|
} |
|
456
|
|
|
$output .= '</ol>'; |
|
457
|
|
|
} |
|
458
|
|
|
|
|
459
|
|
|
$output .= '</footer></div>'; |
|
460
|
|
|
|
|
461
|
|
|
return $output; |
|
462
|
|
|
} |
|
463
|
|
|
|
|
464
|
|
View Code Duplication |
public function escape($string, $encoding = false) |
|
|
|
|
|
|
465
|
|
|
{ |
|
466
|
|
|
if ($encoding === false) { |
|
467
|
|
|
$encoding = BlobObject::detectEncoding($string); |
|
|
|
|
|
|
468
|
|
|
} |
|
469
|
|
|
|
|
470
|
|
|
$original_encoding = $encoding; |
|
|
|
|
|
|
471
|
|
|
|
|
472
|
|
|
if ($encoding === false || $encoding === 'ASCII') { |
|
473
|
|
|
$encoding = 'UTF-8'; |
|
|
|
|
|
|
474
|
|
|
} |
|
475
|
|
|
|
|
476
|
|
|
$string = htmlspecialchars($string, ENT_NOQUOTES, $encoding); |
|
|
|
|
|
|
477
|
|
|
|
|
478
|
|
|
// this call converts all non-ASCII characters into numeirc htmlentities |
|
479
|
|
|
if (extension_loaded('mbstring') && $original_encoding !== 'ASCII') { |
|
|
|
|
|
|
480
|
|
|
$string = mb_encode_numericentity($string, array(0x80, 0xffff, 0, 0xffff), $encoding); |
|
|
|
|
|
|
481
|
|
|
} |
|
482
|
|
|
|
|
483
|
|
|
return $string; |
|
484
|
|
|
} |
|
485
|
|
|
|
|
486
|
|
View Code Duplication |
protected function getPlugin(array $plugins, array $hints) |
|
|
|
|
|
|
487
|
|
|
{ |
|
488
|
|
|
if ($plugins = $this->matchPlugins($plugins, $hints)) { |
|
|
|
|
|
|
489
|
|
|
$plugin = end($plugins); |
|
490
|
|
|
|
|
491
|
|
|
if (!isset($this->plugin_objs[$plugin])) { |
|
492
|
|
|
$this->plugin_objs[$plugin] = new $plugin($this); |
|
493
|
|
|
} |
|
494
|
|
|
|
|
495
|
|
|
return $this->plugin_objs[$plugin]; |
|
496
|
|
|
} |
|
497
|
|
|
} |
|
498
|
|
|
|
|
499
|
|
View Code Duplication |
protected function ideLink($file, $line) |
|
|
|
|
|
|
500
|
|
|
{ |
|
501
|
|
|
$shortenedPath = $this->escape(Kint::shortenPath($file)); |
|
502
|
|
|
if (!$this->file_link_format) { |
|
503
|
|
|
return $shortenedPath.':'.$line; |
|
504
|
|
|
} |
|
505
|
|
|
|
|
506
|
|
|
$ideLink = Kint::getIdeLink($file, $line); |
|
507
|
|
|
$class = (strpos($ideLink, 'http://') === 0) ? 'class="kint-ide-link" ' : ''; |
|
508
|
|
|
|
|
509
|
|
|
return "<a {$class}href=\"{$ideLink}\">{$shortenedPath}:{$line}</a>"; |
|
510
|
|
|
} |
|
511
|
|
|
} |
|
512
|
|
|
|
This check marks property names that have not been written in camelCase.
In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes
databaseConnectionString.