@@ -6,7 +6,8 @@ discard block |
||
6 | 6 | * @return array |
7 | 7 | * @see https://docs.gravityforms.com/gform_noconflict_scripts/ |
8 | 8 | */ |
9 | -add_filter('gform_noconflict_scripts', function (array $scripts) { |
|
9 | +add_filter('gform_noconflict_scripts', function (array $scripts) |
|
10 | +{ |
|
10 | 11 | $scripts[] = 'blackbar'; |
11 | 12 | return $scripts; |
12 | 13 | }); |
@@ -15,7 +16,8 @@ discard block |
||
15 | 16 | * @return array |
16 | 17 | * @see https://docs.gravityforms.com/gform_noconflict_styles/ |
17 | 18 | */ |
18 | -add_filter('gform_noconflict_styles', function (array $styles) { |
|
19 | +add_filter('gform_noconflict_styles', function (array $styles) |
|
20 | +{ |
|
19 | 21 | $styles[] = 'blackbar'; |
20 | 22 | $styles[] = 'blackbar-syntax'; |
21 | 23 | return $styles; |
@@ -124,7 +124,8 @@ |
||
124 | 124 | sprintf($messages['wrong_version'], $messages['php_version'].' '.$this->versions['php']), |
125 | 125 | sprintf($messages['update_php'], PHP_VERSION).'</p><p>'.$rollbackMessage |
126 | 126 | ); |
127 | - } elseif (!$this->isWpValid()) { |
|
127 | + } |
|
128 | + elseif (!$this->isWpValid()) { |
|
128 | 129 | printf($noticeTemplate, |
129 | 130 | sprintf($messages['notice'], $pluginName), |
130 | 131 | sprintf($messages['wrong_version'], $messages['wp_version'].' '.$this->versions['wordpress']), |
@@ -30,12 +30,15 @@ |
||
30 | 30 | && class_exists('\GeminiLabs\Castor\Helpers\Development') |
31 | 31 | && method_exists('\GeminiLabs\Castor\Helpers\Development', 'templatePaths')) { // @phpstan-ignore-line |
32 | 32 | $this->entries = \GeminiLabs\Castor\Facades\Development::templatePaths(); |
33 | - } else { |
|
34 | - $files = array_values(array_filter(get_included_files(), function ($file) { |
|
33 | + } |
|
34 | + else { |
|
35 | + $files = array_values(array_filter(get_included_files(), function ($file) |
|
36 | + { |
|
35 | 37 | $bool = false !== strpos($file, '/themes/') && false === strpos($file, '/functions.php'); |
36 | 38 | return (bool) apply_filters('blackbar/templates/file', $bool, $file); |
37 | 39 | })); |
38 | - $this->entries = array_map(function ($file) { |
|
40 | + $this->entries = array_map(function ($file) |
|
41 | + { |
|
39 | 42 | return str_replace(trailingslashit(WP_CONTENT_DIR), '', $file); |
40 | 43 | }, $files); |
41 | 44 | } |
@@ -55,7 +55,8 @@ |
||
55 | 55 | do_action('blackbar/profiler/start'); // start profiler |
56 | 56 | do_action('blackbar/profiler/noise'); // measure profiler noise |
57 | 57 | add_action('plugins_loaded', [$controller, 'registerLanguages']); |
58 | - add_action('init', function () use ($controller) { |
|
58 | + add_action('init', function () use ($controller) |
|
59 | + { |
|
59 | 60 | if (!apply_filters('blackbar/enabled', current_user_can('administrator'))) { |
60 | 61 | return; |
61 | 62 | } |
@@ -8,9 +8,12 @@ |
||
8 | 8 | </tr> |
9 | 9 | </tbody> |
10 | 10 | </table> |
11 | -<?php else : ?> |
|
11 | +<?php else { |
|
12 | + : ?> |
|
12 | 13 | <form> |
13 | - <input type="text" id="glbb_queries_sql" placeholder="<?= esc_attr__('Find SQL containing', 'blackbar'); ?>"> |
|
14 | + <input type="text" id="glbb_queries_sql" placeholder="<?= esc_attr__('Find SQL containing', 'blackbar'); |
|
15 | +} |
|
16 | +?>"> |
|
14 | 17 | <input type="text" id="glbb_queries_min_time" placeholder="<?= esc_attr__('Minimum execution time', 'blackbar'); ?>"> |
15 | 18 | <select id="glbb_queries_sort_by"> |
16 | 19 | <option value><?= esc_html__('Sort by execution time', 'blackbar'); ?></option> |
@@ -36,7 +36,8 @@ discard block |
||
36 | 36 | if (is_string($key) && "\0" === $key[0]) { |
37 | 37 | $keyParts = explode("\0", $key); |
38 | 38 | $result[] = $keyParts[2].(('*' === $keyParts[1]) ? ':protected' : ':private'); |
39 | - } else { |
|
39 | + } |
|
40 | + else { |
|
40 | 41 | $result[] = $key; |
41 | 42 | } |
42 | 43 | $result[] = '] => '; |
@@ -51,11 +52,14 @@ discard block |
||
51 | 52 | ++$this->level; |
52 | 53 | if ($subject instanceof \Closure) { |
53 | 54 | $this->inspectClosure($subject); |
54 | - } elseif (is_object($subject)) { |
|
55 | + } |
|
56 | + elseif (is_object($subject)) { |
|
55 | 57 | $this->inspectObject($subject); |
56 | - } elseif (is_array($subject)) { |
|
58 | + } |
|
59 | + elseif (is_array($subject)) { |
|
57 | 60 | $this->inspectArray($subject); |
58 | - } else { |
|
61 | + } |
|
62 | + else { |
|
59 | 63 | $this->inspectPrimitive($subject); |
60 | 64 | } |
61 | 65 | --$this->level; |
@@ -84,7 +88,8 @@ discard block |
||
84 | 88 | protected function inspectClosure(\Closure $subject): void |
85 | 89 | { |
86 | 90 | $reflection = new \ReflectionFunction($subject); |
87 | - $params = array_map(function ($param) { |
|
91 | + $params = array_map(function ($param) |
|
92 | + { |
|
88 | 93 | return ($param->isPassedByReference() ? '&$' : '$').$param->name; |
89 | 94 | }, $reflection->getParameters()); |
90 | 95 | $this->result[] = 'Closure ('.implode(', ', $params).') { ... }'."\n"; |
@@ -102,7 +107,8 @@ discard block |
||
102 | 107 | } |
103 | 108 | if ($subject instanceof \ArrayObject) { |
104 | 109 | $this->result[] = $classname." ArrayObject (\n"; |
105 | - } else { |
|
110 | + } |
|
111 | + else { |
|
106 | 112 | $this->result[] = $classname." Object (\n"; |
107 | 113 | $subject = (array) $subject; |
108 | 114 | } |
@@ -122,9 +128,11 @@ discard block |
||
122 | 128 | { |
123 | 129 | if (true === $subject) { |
124 | 130 | $subject = '(bool) true'; |
125 | - } elseif (false === $subject) { |
|
131 | + } |
|
132 | + elseif (false === $subject) { |
|
126 | 133 | $subject = '(bool) false'; |
127 | - } elseif (null === $subject) { |
|
134 | + } |
|
135 | + elseif (null === $subject) { |
|
128 | 136 | $subject = '(null)'; |
129 | 137 | } |
130 | 138 | $this->result[] = $subject."\n"; |
@@ -74,7 +74,8 @@ discard block |
||
74 | 74 | if (array_key_exists((int) $errno, static::ERROR_CODES)) { |
75 | 75 | $errname = static::ERROR_CODES[$errno]; |
76 | 76 | } |
77 | - } else { // entry likely stored by filter hook |
|
77 | + } |
|
78 | + else { // entry likely stored by filter hook |
|
78 | 79 | $errname = 'Debug'; |
79 | 80 | if (array_key_exists($errno, static::MAPPED_ERROR_CODES)) { |
80 | 81 | $errname = $errno; |
@@ -85,7 +86,8 @@ discard block |
||
85 | 86 | $hash = md5($errno.$errname.$message.$location); |
86 | 87 | if (array_key_exists($hash, $this->entries)) { |
87 | 88 | ++$this->entries[$hash]['count']; |
88 | - } else { |
|
89 | + } |
|
90 | + else { |
|
89 | 91 | $this->entries[$hash] = [ |
90 | 92 | 'count' => 0, |
91 | 93 | 'errname' => $errname, |
@@ -99,9 +101,11 @@ discard block |
||
99 | 101 | { |
100 | 102 | if ($message instanceof \DateTime) { |
101 | 103 | $message = $message->format('Y-m-d H:i:s'); |
102 | - } elseif (is_object($message) || is_array($message)) { |
|
104 | + } |
|
105 | + elseif (is_object($message) || is_array($message)) { |
|
103 | 106 | $message = (new Dump())->dump($message); |
104 | - } else { |
|
107 | + } |
|
108 | + else { |
|
105 | 109 | $message = esc_html(trim((string) $message)); |
106 | 110 | } |
107 | 111 | $location = trim($location); |
@@ -8,9 +8,12 @@ |
||
8 | 8 | </tr> |
9 | 9 | </tbody> |
10 | 10 | </table> |
11 | -<?php else : ?> |
|
11 | +<?php else { |
|
12 | + : ?> |
|
12 | 13 | <form> |
13 | - <input type="text" id="glbb_hooks_callback" placeholder="<?= esc_attr__('Find callbacks containing', 'blackbar'); ?>"> |
|
14 | + <input type="text" id="glbb_hooks_callback" placeholder="<?= esc_attr__('Find callbacks containing', 'blackbar'); |
|
15 | +} |
|
16 | +?>"> |
|
14 | 17 | <input type="text" id="glbb_hooks_min_time" placeholder="<?= esc_attr__('Minimum total time', 'blackbar'); ?>"> |
15 | 18 | <select id="glbb_hooks_sort_by"> |
16 | 19 | <option value><?= esc_html__('Sort by total time', 'blackbar'); ?></option> |
@@ -10,12 +10,15 @@ |
||
10 | 10 | </tbody> |
11 | 11 | </table> |
12 | 12 | </div> |
13 | -<?php else : ?> |
|
13 | +<?php else { |
|
14 | + : ?> |
|
14 | 15 | <div> |
15 | 16 | <table class="glbb-grid"> |
16 | 17 | <tbody> |
17 | 18 | <?php foreach ($module->entries() as $entry) : ?> |
18 | - <tr data-errname="<?= esc_attr($entry['errname']); ?>"> |
|
19 | + <tr data-errname="<?= esc_attr($entry['errname']); |
|
20 | +} |
|
21 | +?>"> |
|
19 | 22 | <td> |
20 | 23 | <span class="glbb-info glbb-<?= $entry['errname']; ?>"><?= esc_html($entry['name']); ?></span> |
21 | 24 | </td> |