Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
DebugExtension.php
01 <?php
02
03 /*
04 * This file is part of Twig.
05 *
06 * (c) Fabien Potencier
07 *
08 * For the full copyright and license information, please view the LICENSE
09 * file that was distributed with this source code.
10 */
11
12 namespace Twig\Extension {
13 use Twig\TwigFunction;
14
15 final class DebugExtension extends AbstractExtension
16 {
17 public function getFunctions()
18 {
19 // dump is safe if var_dump is overridden by xdebug
20 $isDumpOutputHtmlSafe = \extension_loaded('xdebug')
21 // false means that it was not set (and the default is on) or it explicitly enabled
22 && (false === ini_get('xdebug.overload_var_dump') || ini_get('xdebug.overload_var_dump'))
23 // false means that it was not set (and the default is on) or it explicitly enabled
24 // xdebug.overload_var_dump produces HTML only when html_errors is also enabled
25 && (false === ini_get('html_errors') || ini_get('html_errors'))
26 || 'cli' === \PHP_SAPI
27 ;
28
29 return [
30 new TwigFunction('dump', 'twig_var_dump', ['is_safe' => $isDumpOutputHtmlSafe ? ['html'] : [], 'needs_context' => true, 'needs_environment' => true, 'is_variadic' => true]),
31 ];
32 }
33 }
34
35 class_alias('Twig\Extension\DebugExtension', 'Twig_Extension_Debug');
36 }
37
38 namespace {
39 use Twig\Environment;
40 use Twig\Template;
41 use Twig\TemplateWrapper;
42
43 function twig_var_dump(Environment $env, $context, ...$vars)
44 {
45 if (!$env->isDebug()) {
46 return;
47 }
48
49 ob_start();
50
51 if (!$vars) {
52 $vars = [];
53 foreach ($context as $key => $value) {
54 if (!$value instanceof Template && !$value instanceof TemplateWrapper) {
55 $vars[$key] = $value;
56 }
57 }
58
59 var_dump($vars);
60 } else {
61 var_dump(...$vars);
62 }
63
64 return ob_get_clean();
65 }
66 }
67