Passed
Push — master ( aae94f...9791c9 )
by Paul
05:04
created
plugin/Controller.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
      */
10 10
     protected $app;
11 11
 
12
-    public function __construct(Application $app)
12
+    public function __construct( Application $app )
13 13
     {
14 14
         $this->app = $app;
15 15
     }
@@ -20,18 +20,18 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function enqueueAssets(): void
22 22
     {
23
-        wp_enqueue_script(Application::ID, $this->app->url('assets/main.js'));
24
-        wp_enqueue_style(Application::ID, $this->app->url('assets/main.css'), ['dashicons']);
25
-        wp_enqueue_style(Application::ID.'-syntax', $this->app->url('assets/syntax.css'));
23
+        wp_enqueue_script( Application::ID, $this->app->url( 'assets/main.js' ) );
24
+        wp_enqueue_style( Application::ID, $this->app->url( 'assets/main.css' ), [ 'dashicons' ] );
25
+        wp_enqueue_style( Application::ID . '-syntax', $this->app->url( 'assets/syntax.css' ) );
26 26
     }
27 27
 
28 28
     /**
29 29
      * @param string $classes
30 30
      * @action admin_body_class
31 31
      */
32
-    public function filterBodyClasses($classes): string
32
+    public function filterBodyClasses( $classes ): string
33 33
     {
34
-        return trim((string) $classes.' '.Application::ID);
34
+        return trim( (string) $classes . ' ' . Application::ID );
35 35
     }
36 36
 
37 37
     /**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function initActions(): void
41 41
     {
42
-        if (!class_exists('Debug_Bar_Slow_Actions')) {
42
+        if( !class_exists( 'Debug_Bar_Slow_Actions' ) ) {
43 43
             $this->app->actions->startTimer();
44 44
         }
45 45
     }
@@ -49,19 +49,19 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function initConsole(): void
51 51
     {
52
-        if (Application::CONSOLE_HOOK !== func_get_arg(0)) {
52
+        if( Application::CONSOLE_HOOK !== func_get_arg( 0 ) ) {
53 53
             return;
54 54
         }
55
-        $args = array_pad(func_get_args(), 4, '');
56
-        $args = array_combine(['hook', 'message', 'errno', 'location'], $args);
57
-        $args = array_map('sanitize_textarea_field', $args);
58
-        $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 4);
59
-        $entry = array_pop($backtrace); // get the fourth backtrace entry
60
-        if (empty(trim($args['location'])) && array_key_exists('file', $entry)) {
61
-            $path = explode(ABSPATH, $entry['file']);
62
-            $args['location'] = sprintf('%s:%s', array_pop($path), $entry['line']);
55
+        $args = array_pad( func_get_args(), 4, '' );
56
+        $args = array_combine( [ 'hook', 'message', 'errno', 'location' ], $args );
57
+        $args = array_map( 'sanitize_textarea_field', $args );
58
+        $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 4 );
59
+        $entry = array_pop( $backtrace ); // get the fourth backtrace entry
60
+        if( empty( trim( $args[ 'location' ] ) ) && array_key_exists( 'file', $entry ) ) {
61
+            $path = explode( ABSPATH, $entry[ 'file' ] );
62
+            $args[ 'location' ] = sprintf( '%s:%s', array_pop( $path ), $entry[ 'line' ] );
63 63
         }
64
-        $this->app->console->store($args['message'], $args['errno'], $args['location']);
64
+        $this->app->console->store( $args[ 'message' ], $args[ 'errno' ], $args[ 'location' ] );
65 65
     }
66 66
 
67 67
     /**
@@ -69,19 +69,19 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public function initProfiler(): void
71 71
     {
72
-        $hook = func_get_arg(0);
73
-        $name = func_num_args() > 1 ? func_get_arg(1) : 'Timer';
74
-        $microtime = microtime(true);
75
-        if ('timer:start' === $hook) {
76
-            $this->app->profiler->start($name);
77
-        } elseif ('timer:stop' === $hook) {
78
-            $this->app->profiler->stop($name);
79
-        } elseif ('blackbar/profiler/noise' === $hook) {
80
-            $this->app->profiler->setNoise($microtime);
81
-        } elseif ('blackbar/profiler/start' === $hook) {
82
-            $this->app->profiler->setStart($microtime);
83
-        } elseif ('blackbar/profiler/stop' === $hook) {
84
-            $this->app->profiler->setStop($microtime);
72
+        $hook = func_get_arg( 0 );
73
+        $name = func_num_args() > 1 ? func_get_arg( 1 ) : 'Timer';
74
+        $microtime = microtime( true );
75
+        if( 'timer:start' === $hook ) {
76
+            $this->app->profiler->start( $name );
77
+        } elseif( 'timer:stop' === $hook ) {
78
+            $this->app->profiler->stop( $name );
79
+        } elseif( 'blackbar/profiler/noise' === $hook ) {
80
+            $this->app->profiler->setNoise( $microtime );
81
+        } elseif( 'blackbar/profiler/start' === $hook ) {
82
+            $this->app->profiler->setStart( $microtime );
83
+        } elseif( 'blackbar/profiler/stop' === $hook ) {
84
+            $this->app->profiler->setStop( $microtime );
85 85
         }
86 86
     }
87 87
 
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
      */
91 91
     public function registerLanguages(): void
92 92
     {
93
-        load_plugin_textdomain(Application::ID, false,
94
-            plugin_basename($this->app->path()).'/languages/'
93
+        load_plugin_textdomain( Application::ID, false,
94
+            plugin_basename( $this->app->path() ) . '/languages/'
95 95
         );
96 96
     }
97 97
 
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function renderBar(): void
103 103
     {
104
-        do_action('blackbar/profiler/stop'); // stop profiler
105
-        $this->app->render('debug-bar', [
104
+        do_action( 'blackbar/profiler/stop' ); // stop profiler
105
+        $this->app->render( 'debug-bar', [
106 106
             'modules' => [ // order is intentional
107 107
                 $this->app->console,
108 108
                 $this->app->profiler,
@@ -111,6 +111,6 @@  discard block
 block discarded – undo
111 111
                 $this->app->templates,
112 112
                 $this->app->globals,
113 113
             ],
114
-        ]);
114
+        ] );
115 115
     }
116 116
 }
Please login to merge, or discard this patch.
plugin/Dump.php 1 patch
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -11,21 +11,21 @@  discard block
 block discarded – undo
11 11
     public $ignore;
12 12
 
13 13
     protected $level = 0;
14
-    protected $result = [];
15
-    protected $stack = [];
14
+    protected $result = [ ];
15
+    protected $stack = [ ];
16 16
 
17 17
     /**
18 18
      * @param mixed $value
19 19
      * @param int $depth
20 20
      * @return string
21 21
      */
22
-    public function dump($value, $depth = 3, array $ignore = [])
22
+    public function dump( $value, $depth = 3, array $ignore = [ ] )
23 23
     {
24 24
         $this->depth = $depth;
25 25
         $this->ignore = $ignore;
26 26
         $this->reset();
27
-        $this->inspect($value);
28
-        $result = rtrim(implode('', $this->result), "\n");
27
+        $this->inspect( $value );
28
+        $result = rtrim( implode( '', $this->result ), "\n" );
29 29
         $this->reset();
30 30
         return $result;
31 31
     }
@@ -34,35 +34,35 @@  discard block
 block discarded – undo
34 34
      * @param string $key
35 35
      * @return string
36 36
      */
37
-    protected function formatKey($key)
37
+    protected function formatKey( $key )
38 38
     {
39
-        $result = [];
40
-        $result[] = str_repeat(' ', $this->level * 4).'[';
41
-        if (is_string($key) && "\0" === $key[0]) {
42
-            $keyParts = explode("\0", $key);
43
-            $result[] = $keyParts[2].(('*' === $keyParts[1]) ? ':protected' : ':private');
39
+        $result = [ ];
40
+        $result[ ] = str_repeat( ' ', $this->level * 4 ) . '[';
41
+        if( is_string( $key ) && "\0" === $key[ 0 ] ) {
42
+            $keyParts = explode( "\0", $key );
43
+            $result[ ] = $keyParts[ 2 ] . ( ( '*' === $keyParts[ 1 ] ) ? ':protected' : ':private' );
44 44
         } else {
45
-            $result[] = $key;
45
+            $result[ ] = $key;
46 46
         }
47
-        $result[] = '] => ';
48
-        return implode('', $result);
47
+        $result[ ] = '] => ';
48
+        return implode( '', $result );
49 49
     }
50 50
 
51 51
     /**
52 52
      * @param mixed $subject
53 53
      * @return void
54 54
      */
55
-    protected function inspect($subject)
55
+    protected function inspect( $subject )
56 56
     {
57 57
         ++$this->level;
58
-        if ($subject instanceof \Closure) {
59
-            $this->inspectClosure($subject);
60
-        } elseif (is_object($subject)) {
61
-            $this->inspectObject($subject);
62
-        } elseif (is_array($subject)) {
63
-            $this->inspectArray($subject);
58
+        if( $subject instanceof \Closure ) {
59
+            $this->inspectClosure( $subject );
60
+        } elseif( is_object( $subject ) ) {
61
+            $this->inspectObject( $subject );
62
+        } elseif( is_array( $subject ) ) {
63
+            $this->inspectArray( $subject );
64 64
         } else {
65
-            $this->inspectPrimitive($subject);
65
+            $this->inspectPrimitive( $subject );
66 66
         }
67 67
         --$this->level;
68 68
     }
@@ -70,87 +70,87 @@  discard block
 block discarded – undo
70 70
     /**
71 71
      * @return void
72 72
      */
73
-    protected function inspectArray(array $subject)
73
+    protected function inspectArray( array $subject )
74 74
     {
75
-        if ($this->level > $this->depth) {
76
-            $this->result[] = "Nested Array\n";
75
+        if( $this->level > $this->depth ) {
76
+            $this->result[ ] = "Nested Array\n";
77 77
             return;
78 78
         }
79
-        if (empty($subject)) {
80
-            $this->result[] = "Array ()\n";
79
+        if( empty( $subject ) ) {
80
+            $this->result[ ] = "Array ()\n";
81 81
             return;
82 82
         }
83
-        $this->result[] = "Array (\n";
84
-        foreach ($subject as $key => $val) {
85
-            if (false === $this->isIgnoredKey($key)) {
86
-                $this->result[] = str_repeat(' ', $this->level * 4).'['.$key.'] => ';
87
-                $this->inspect($val);
83
+        $this->result[ ] = "Array (\n";
84
+        foreach( $subject as $key => $val ) {
85
+            if( false === $this->isIgnoredKey( $key ) ) {
86
+                $this->result[ ] = str_repeat( ' ', $this->level * 4 ) . '[' . $key . '] => ';
87
+                $this->inspect( $val );
88 88
             }
89 89
         }
90
-        $this->result[] = str_repeat(' ', ($this->level - 1) * 4).")\n";
90
+        $this->result[ ] = str_repeat( ' ', ( $this->level - 1 ) * 4 ) . ")\n";
91 91
     }
92 92
 
93 93
     /**
94 94
      * @return void
95 95
      */
96
-    protected function inspectClosure(\Closure $subject)
96
+    protected function inspectClosure( \Closure $subject )
97 97
     {
98
-        $reflection = new \ReflectionFunction($subject);
99
-        $params = array_map(function ($param) {
100
-            return ($param->isPassedByReference() ? '&$' : '$').$param->name;
101
-        }, $reflection->getParameters());
102
-        $this->result[] = 'Closure ('.implode(', ', $params).') { ... }'."\n";
98
+        $reflection = new \ReflectionFunction( $subject );
99
+        $params = array_map( function( $param ) {
100
+            return ( $param->isPassedByReference() ? '&$' : '$' ) . $param->name;
101
+        }, $reflection->getParameters() );
102
+        $this->result[ ] = 'Closure (' . implode( ', ', $params ) . ') { ... }' . "\n";
103 103
     }
104 104
 
105 105
     /**
106 106
      * @param object $subject
107 107
      * @return void
108 108
      */
109
-    protected function inspectObject($subject)
109
+    protected function inspectObject( $subject )
110 110
     {
111
-        $classname = get_class($subject);
112
-        if ($this->level > $this->depth) {
113
-            $this->result[] = 'Nested '.$classname." Object\n";
111
+        $classname = get_class( $subject );
112
+        if( $this->level > $this->depth ) {
113
+            $this->result[ ] = 'Nested ' . $classname . " Object\n";
114 114
             return;
115 115
         }
116
-        if ($subject instanceof \ArrayObject) {
117
-            $this->result[] = $classname." ArrayObject (\n";
116
+        if( $subject instanceof \ArrayObject ) {
117
+            $this->result[ ] = $classname . " ArrayObject (\n";
118 118
         } else {
119
-            $this->result[] = $classname." Object (\n";
119
+            $this->result[ ] = $classname . " Object (\n";
120 120
             $subject = (array) $subject;
121 121
         }
122
-        foreach ($subject as $key => $val) {
123
-            if (false === $this->isIgnoredKey($key)) {
124
-                $this->result[] = $this->formatKey($key);
125
-                $this->inspect($val);
122
+        foreach( $subject as $key => $val ) {
123
+            if( false === $this->isIgnoredKey( $key ) ) {
124
+                $this->result[ ] = $this->formatKey( $key );
125
+                $this->inspect( $val );
126 126
             }
127 127
         }
128
-        $this->result[] = str_repeat(' ', ($this->level - 1) * 4).")\n";
128
+        $this->result[ ] = str_repeat( ' ', ( $this->level - 1 ) * 4 ) . ")\n";
129 129
     }
130 130
 
131 131
     /**
132 132
      * @param mixed $subject
133 133
      * @return void
134 134
      */
135
-    protected function inspectPrimitive($subject)
135
+    protected function inspectPrimitive( $subject )
136 136
     {
137
-        if (true === $subject) {
137
+        if( true === $subject ) {
138 138
             $subject = '(bool) true';
139
-        } elseif (false === $subject) {
139
+        } elseif( false === $subject ) {
140 140
             $subject = '(bool) false';
141
-        } elseif (null === $subject) {
141
+        } elseif( null === $subject ) {
142 142
             $subject = '(null)';
143 143
         }
144
-        $this->result[] = $subject."\n";
144
+        $this->result[ ] = $subject . "\n";
145 145
     }
146 146
 
147 147
     /**
148 148
      * @param string $key
149 149
      * @return bool
150 150
      */
151
-    protected function isIgnoredKey($key)
151
+    protected function isIgnoredKey( $key )
152 152
     {
153
-        return in_array($key, $this->ignore);
153
+        return in_array( $key, $this->ignore );
154 154
     }
155 155
 
156 156
     /**
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
     protected function reset()
160 160
     {
161 161
         $this->level = 0;
162
-        $this->result = [];
163
-        $this->stack = [];
162
+        $this->result = [ ];
163
+        $this->stack = [ ];
164 164
     }
165 165
 }
166 166
 
Please login to merge, or discard this patch.
views/debug-bar.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div id="glbb">
4
-    <?php foreach ($modules as $module) : /* Ensure that the console entries are loaded last */ ?>
5
-        <?php if (!$module->isVisible() || 'glbb-console' === $module->id()) continue; ?>
4
+    <?php foreach( $modules as $module ) : /* Ensure that the console entries are loaded last */ ?>
5
+        <?php if( !$module->isVisible() || 'glbb-console' === $module->id() ) continue; ?>
6 6
         <div id="<?= $module->id(); ?>" class="glbb-panel glbb-hidden">
7 7
             <?php $module->render(); ?>
8 8
         </div>
9 9
     <?php endforeach; ?>
10
-    <?php foreach ($modules as $module) : /* Ensure that the console entries are loaded last */ ?>
11
-        <?php if (!$module->isVisible() || 'glbb-console' !== $module->id()) continue; ?>
10
+    <?php foreach( $modules as $module ) : /* Ensure that the console entries are loaded last */ ?>
11
+        <?php if( !$module->isVisible() || 'glbb-console' !== $module->id() ) continue; ?>
12 12
         <div id="<?= $module->id(); ?>" class="glbb-panel glbb-hidden">
13 13
             <?php $module->render(); ?>
14 14
         </div>
@@ -16,19 +16,19 @@  discard block
 block discarded – undo
16 16
     <div class="glbb-panel-links">
17 17
         <a href="#" class="dashicons-before glbb-toggle">
18 18
             <span class="screen-reader-text">
19
-                <?= esc_html__('Toggle', 'blackbar'); ?>
19
+                <?= esc_html__( 'Toggle', 'blackbar' ); ?>
20 20
             </span>
21 21
         </a>
22
-        <?php foreach ($modules as $module) : ?>
23
-            <?php if (!$module->isVisible()) continue; ?>
24
-            <a href="#" data-panel="<?= esc_attr($module->id()); ?>" class="dashicons-before <?= $module->id(); ?>">
22
+        <?php foreach( $modules as $module ) : ?>
23
+            <?php if( !$module->isVisible() ) continue; ?>
24
+            <a href="#" data-panel="<?= esc_attr( $module->id() ); ?>" class="dashicons-before <?= $module->id(); ?>">
25 25
                 <span><?= $module->label(); ?></span>
26 26
             </a>
27 27
         <?php endforeach; ?>
28 28
         <div>
29 29
             <a href="#" class="dashicons-before glbb-close">
30 30
                 <span class="screen-reader-text">
31
-                    <?= esc_html__('Close', 'blackbar'); ?>
31
+                    <?= esc_html__( 'Close', 'blackbar' ); ?>
32 32
                 </span>
33 33
             </a>
34 34
         </div>
Please login to merge, or discard this patch.
views/panels/queries.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,32 +1,32 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3
-<?php if (!defined('SAVEQUERIES') || !SAVEQUERIES) : ?>
3
+<?php if( !defined( 'SAVEQUERIES' ) || !SAVEQUERIES ) : ?>
4 4
     <table>
5 5
         <tbody>
6 6
             <tr>
7
-                <td><a href="https://wordpress.org/documentation/article/debugging-in-wordpress/#savequeries" target="_blank">SAVEQUERIES</a> <?= esc_html_x('must be enabled to view SQL queries', 'SAVEQUERIES', 'blackbar'); ?>.</td>
7
+                <td><a href="https://wordpress.org/documentation/article/debugging-in-wordpress/#savequeries" target="_blank">SAVEQUERIES</a> <?= esc_html_x( 'must be enabled to view SQL queries', 'SAVEQUERIES', 'blackbar' ); ?>.</td>
8 8
             </tr>
9 9
         </tbody>
10 10
     </table>
11 11
 <?php else : ?>
12 12
     <form>
13
-        <input type="text" id="glbb_queries_sql" placeholder="<?= esc_attr__('Find SQL containing', 'blackbar'); ?>">
14
-        <input type="text" id="glbb_queries_min_time" placeholder="<?= esc_attr__('Minimum execution time', 'blackbar'); ?>">
13
+        <input type="text" id="glbb_queries_sql" placeholder="<?= esc_attr__( 'Find SQL containing', 'blackbar' ); ?>">
14
+        <input type="text" id="glbb_queries_min_time" placeholder="<?= esc_attr__( 'Minimum execution time', 'blackbar' ); ?>">
15 15
         <select id="glbb_queries_sort_by">
16
-            <option value><?= esc_html__('Sort by execution time', 'blackbar'); ?></option>
17
-            <option value="order"><?= esc_html__('Sort by execution order', 'blackbar'); ?></option>
16
+            <option value><?= esc_html__( 'Sort by execution time', 'blackbar' ); ?></option>
17
+            <option value="order"><?= esc_html__( 'Sort by execution order', 'blackbar' ); ?></option>
18 18
         </select>
19 19
     </form>
20 20
     <table class="glbb-grid">
21 21
         <tbody>
22
-            <?php foreach ($queries->entries() as $entry) : ?>
23
-                <tr class="glbb-row-collapsed" data-index="<?= esc_attr($entry['index']); ?>" data-time="<?= esc_attr($entry['time']); ?>">
24
-                    <td data-time="<?= esc_attr($entry['time']); ?>"><div class="glbb-row-toggle dashicons-before dashicons-arrow-right"><?= esc_html($entry['time']); ?></div></td>
25
-                    <td data-sql><pre><code class="language-sql"><?= esc_html($entry['sql']); ?></code></pre></td>
22
+            <?php foreach( $queries->entries() as $entry ) : ?>
23
+                <tr class="glbb-row-collapsed" data-index="<?= esc_attr( $entry[ 'index' ] ); ?>" data-time="<?= esc_attr( $entry[ 'time' ] ); ?>">
24
+                    <td data-time="<?= esc_attr( $entry[ 'time' ] ); ?>"><div class="glbb-row-toggle dashicons-before dashicons-arrow-right"><?= esc_html( $entry[ 'time' ] ); ?></div></td>
25
+                    <td data-sql><pre><code class="language-sql"><?= esc_html( $entry[ 'sql' ] ); ?></code></pre></td>
26 26
                     <td class="glbb-row-details">
27 27
                         <ol>
28
-                            <?php foreach ($entry['trace'] as $index => $line) : ?>
29
-                                <li value="<?= esc_attr($index + 1); ?>"><?= esc_html($line); ?></li>
28
+                            <?php foreach( $entry[ 'trace' ] as $index => $line ) : ?>
29
+                                <li value="<?= esc_attr( $index + 1 ); ?>"><?= esc_html( $line ); ?></li>
30 30
                             <?php endforeach; ?>
31 31
                         </ol>
32 32
                     </td>
Please login to merge, or discard this patch.
views/panels/globals.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3
-<?php if ($globals->hasEntries()) : ?>
3
+<?php if( $globals->hasEntries() ) : ?>
4 4
     <table class="glbb-grid">
5 5
         <tbody>
6
-            <?php foreach ($globals->entries() as $entry) : ?>
6
+            <?php foreach( $globals->entries() as $entry ) : ?>
7 7
                 <tr class="glbb-row-collapsed">
8
-                    <td><div class="glbb-row-toggle dashicons-before dashicons-arrow-right"><?= esc_html($entry['name']); ?></div></td>
8
+                    <td><div class="glbb-row-toggle dashicons-before dashicons-arrow-right"><?= esc_html( $entry[ 'name' ] ); ?></div></td>
9 9
                     <td class="glbb-row-details">
10
-                        <pre><code><?= esc_html($entry['value']); ?></code></pre></td>
10
+                        <pre><code><?= esc_html( $entry[ 'value' ] ); ?></code></pre></td>
11 11
                     </tr>
12 12
                 </tr>
13 13
             <?php endforeach; ?>
Please login to merge, or discard this patch.
views/panels/actions.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,45 +1,45 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3
-<?php if (!$actions->hasEntries()) : ?>
3
+<?php if( !$actions->hasEntries() ) : ?>
4 4
     <table>
5 5
         <tbody>
6 6
             <tr>
7
-                <td><?= esc_html__('Please deactivate the Debug Bar Slow Actions plugin.', 'blackbar'); ?></td>
7
+                <td><?= esc_html__( 'Please deactivate the Debug Bar Slow Actions plugin.', 'blackbar' ); ?></td>
8 8
             </tr>
9 9
         </tbody>
10 10
     </table>
11 11
 <?php else : ?>
12 12
     <form>
13
-        <input type="text" id="glbb_actions_callback" placeholder="<?= esc_attr__('Find callbacks containing', 'blackbar'); ?>">
14
-        <input type="text" id="glbb_actions_min_time" placeholder="<?= esc_attr__('Minimum total time', 'blackbar'); ?>">
13
+        <input type="text" id="glbb_actions_callback" placeholder="<?= esc_attr__( 'Find callbacks containing', 'blackbar' ); ?>">
14
+        <input type="text" id="glbb_actions_min_time" placeholder="<?= esc_attr__( 'Minimum total time', 'blackbar' ); ?>">
15 15
         <select id="glbb_actions_sort_by">
16
-            <option value><?= esc_html__('Sort by total time', 'blackbar'); ?></option>
17
-            <option value="order"><?= esc_html__('Sort by execution order', 'blackbar'); ?></option>
16
+            <option value><?= esc_html__( 'Sort by total time', 'blackbar' ); ?></option>
17
+            <option value="order"><?= esc_html__( 'Sort by execution order', 'blackbar' ); ?></option>
18 18
         </select>
19 19
     </form>
20 20
     <table class="glbb-grid">
21 21
         <thead>
22 22
             <tr>
23
-                <th><?= esc_html__('Action or Filter (Slowest 50)', 'blackbar'); ?></th>
24
-                <th><?= esc_html__('Callbacks', 'blackbar'); ?></th>
25
-                <th><?= esc_html__('Calls', 'blackbar'); ?></th>
26
-                <th><?= esc_html__('Per Call', 'blackbar'); ?></th>
27
-                <th><?= esc_html__('Total', 'blackbar'); ?></th>
23
+                <th><?= esc_html__( 'Action or Filter (Slowest 50)', 'blackbar' ); ?></th>
24
+                <th><?= esc_html__( 'Callbacks', 'blackbar' ); ?></th>
25
+                <th><?= esc_html__( 'Calls', 'blackbar' ); ?></th>
26
+                <th><?= esc_html__( 'Per Call', 'blackbar' ); ?></th>
27
+                <th><?= esc_html__( 'Total', 'blackbar' ); ?></th>
28 28
             </tr>
29 29
         </thead>
30 30
         <tbody>
31
-            <?php foreach ($actions->entries() as $action => $data) : ?>
32
-                <tr class="glbb-row-collapsed" data-index="<?= esc_attr($data['index']); ?>" data-time="<?= esc_attr($data['total']); ?>">
33
-                    <td><div class="glbb-row-toggle dashicons-before dashicons-arrow-right"><?= esc_html($action); ?></div></td>
34
-                    <td data-callbacks="<?= esc_attr($data['callbacks_count']); ?>"><?= esc_html($data['callbacks_count']); ?></td>
35
-                    <td data-calls="<?= esc_attr($data['count']); ?>"><?= esc_html($data['count']); ?></td>
36
-                    <td data-percall="<?= esc_attr(sprintf('%.2f', $data['total'] / $data['count'])); ?>"><?= esc_html(sprintf('%.2f ms', $data['total'] / $data['count'])); ?></td>
37
-                    <td data-total="<?= esc_attr($data['total']); ?>"><?= esc_html(sprintf('%.2f ms', $data['total'])); ?></td>
31
+            <?php foreach( $actions->entries() as $action => $data ) : ?>
32
+                <tr class="glbb-row-collapsed" data-index="<?= esc_attr( $data[ 'index' ] ); ?>" data-time="<?= esc_attr( $data[ 'total' ] ); ?>">
33
+                    <td><div class="glbb-row-toggle dashicons-before dashicons-arrow-right"><?= esc_html( $action ); ?></div></td>
34
+                    <td data-callbacks="<?= esc_attr( $data[ 'callbacks_count' ] ); ?>"><?= esc_html( $data[ 'callbacks_count' ] ); ?></td>
35
+                    <td data-calls="<?= esc_attr( $data[ 'count' ] ); ?>"><?= esc_html( $data[ 'count' ] ); ?></td>
36
+                    <td data-percall="<?= esc_attr( sprintf( '%.2f', $data[ 'total' ] / $data[ 'count' ] ) ); ?>"><?= esc_html( sprintf( '%.2f ms', $data[ 'total' ] / $data[ 'count' ] ) ); ?></td>
37
+                    <td data-total="<?= esc_attr( $data[ 'total' ] ); ?>"><?= esc_html( sprintf( '%.2f ms', $data[ 'total' ] ) ); ?></td>
38 38
                     <td class="glbb-row-details">
39 39
                         <ol>
40
-                            <?php foreach ($data['callbacks'] as $priority => $callbacks) : ?>
41
-                                <?php foreach ($callbacks as $callback) : ?>
42
-                                    <li value="<?= esc_attr($priority); ?>"><?= esc_html($callback); ?></li>
40
+                            <?php foreach( $data[ 'callbacks' ] as $priority => $callbacks ) : ?>
41
+                                <?php foreach( $callbacks as $callback ) : ?>
42
+                                    <li value="<?= esc_attr( $priority ); ?>"><?= esc_html( $callback ); ?></li>
43 43
                                 <?php endforeach; ?>
44 44
                             <?php endforeach; ?>
45 45
                         </ol>
Please login to merge, or discard this patch.
views/panels/templates.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3
-<?php if ($templates->hasEntries()) : ?>
3
+<?php if( $templates->hasEntries() ) : ?>
4 4
     <table class="glbb-grid">
5 5
         <tbody>
6
-            <?php foreach ($templates->entries() as $index => $template) : ?>
6
+            <?php foreach( $templates->entries() as $index => $template ) : ?>
7 7
                 <tr>
8 8
                     <td>
9 9
                         <ol>
10
-                            <li value="<?= esc_attr($index + 1); ?>"><?= esc_html($template); ?></li>
10
+                            <li value="<?= esc_attr( $index + 1 ); ?>"><?= esc_html( $template ); ?></li>
11 11
                         </ol>
12 12
                     </td>
13 13
                 </tr>
Please login to merge, or discard this patch.
plugin/Application.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -28,44 +28,44 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function __construct()
30 30
     {
31
-        $file = wp_normalize_path((new \ReflectionClass($this))->getFileName());
32
-        $this->actions = new Actions($this);
33
-        $this->console = new Console($this);
34
-        $this->file = str_replace('plugin/Application', static::ID, $file);
35
-        $this->globals = new Globals($this);
36
-        $this->profiler = new Profiler($this);
37
-        $this->queries = new Queries($this);
38
-        $this->templates = new Templates($this);
31
+        $file = wp_normalize_path( ( new \ReflectionClass( $this ) )->getFileName() );
32
+        $this->actions = new Actions( $this );
33
+        $this->console = new Console( $this );
34
+        $this->file = str_replace( 'plugin/Application', static::ID, $file );
35
+        $this->globals = new Globals( $this );
36
+        $this->profiler = new Profiler( $this );
37
+        $this->queries = new Queries( $this );
38
+        $this->templates = new Templates( $this );
39 39
     }
40 40
 
41
-    public function errorHandler(int $errno, string $message, string $file, int $line): bool
41
+    public function errorHandler( int $errno, string $message, string $file, int $line ): bool
42 42
     {
43
-        $path = explode(ABSPATH, $file);
44
-        $location = sprintf('%s:%s', array_pop($path), $line);
45
-        $this->console->store($message, (string) $errno, $location);
43
+        $path = explode( ABSPATH, $file );
44
+        $location = sprintf( '%s:%s', array_pop( $path ), $line );
45
+        $this->console->store( $message, (string) $errno, $location );
46 46
         return true;
47 47
     }
48 48
 
49 49
     public function init(): void
50 50
     {
51
-        $controller = new Controller($this);
52
-        add_action('all', [$controller, 'initActions']);
53
-        add_action('all', [$controller, 'initConsole']);
54
-        add_action('all', [$controller, 'initProfiler']);
55
-        do_action('blackbar/profiler/start'); // start profiler
56
-        do_action('blackbar/profiler/noise'); // measure profiler noise
57
-        add_action('plugins_loaded', [$controller, 'registerLanguages']);
58
-        add_action('init', function () use ($controller) {
59
-            if (!apply_filters('blackbar/enabled', current_user_can('administrator'))) {
51
+        $controller = new Controller( $this );
52
+        add_action( 'all', [ $controller, 'initActions' ] );
53
+        add_action( 'all', [ $controller, 'initConsole' ] );
54
+        add_action( 'all', [ $controller, 'initProfiler' ] );
55
+        do_action( 'blackbar/profiler/start' ); // start profiler
56
+        do_action( 'blackbar/profiler/noise' ); // measure profiler noise
57
+        add_action( 'plugins_loaded', [ $controller, 'registerLanguages' ] );
58
+        add_action( 'init', function() use ( $controller ) {
59
+            if( !apply_filters( 'blackbar/enabled', current_user_can( 'administrator' ) ) ) {
60 60
                 return;
61 61
             }
62
-            add_action('admin_enqueue_scripts', [$controller, 'enqueueAssets']);
63
-            add_action('wp_enqueue_scripts', [$controller, 'enqueueAssets']);
64
-            add_action('admin_footer', [$controller, 'renderBar'], 99999);
65
-            add_action('wp_footer', [$controller, 'renderBar'], 99999);
66
-            add_filter('admin_body_class', [$controller, 'filterBodyClasses']);
62
+            add_action( 'admin_enqueue_scripts', [ $controller, 'enqueueAssets' ] );
63
+            add_action( 'wp_enqueue_scripts', [ $controller, 'enqueueAssets' ] );
64
+            add_action( 'admin_footer', [ $controller, 'renderBar' ], 99999 );
65
+            add_action( 'wp_footer', [ $controller, 'renderBar' ], 99999 );
66
+            add_filter( 'admin_body_class', [ $controller, 'filterBodyClasses' ] );
67 67
         });
68
-        set_error_handler([$this, 'errorHandler'], E_ALL | E_STRICT);
68
+        set_error_handler( [ $this, 'errorHandler' ], E_ALL | E_STRICT );
69 69
     }
70 70
 
71 71
     /**
@@ -73,32 +73,32 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public static function load()
75 75
     {
76
-        if (empty(self::$instance)) {
76
+        if( empty( self::$instance ) ) {
77 77
             self::$instance = new static();
78 78
         }
79 79
         return self::$instance;
80 80
     }
81 81
 
82
-    public function path(string $file = '', bool $realpath = true): string
82
+    public function path( string $file = '', bool $realpath = true ): string
83 83
     {
84 84
         $path = $realpath
85
-            ? plugin_dir_path($this->file)
86
-            : trailingslashit(WP_PLUGIN_DIR).basename(dirname($this->file));
87
-        return trailingslashit($path).ltrim(trim($file), '/');
85
+            ? plugin_dir_path( $this->file )
86
+            : trailingslashit( WP_PLUGIN_DIR ) . basename( dirname( $this->file ) );
87
+        return trailingslashit( $path ) . ltrim( trim( $file ), '/' );
88 88
     }
89 89
 
90
-    public function render(string $view, array $data = []): void
90
+    public function render( string $view, array $data = [ ] ): void
91 91
     {
92
-        $file = $this->path(sprintf('views/%s.php', str_replace('.php', '', $view)));
93
-        if (!file_exists($file)) {
92
+        $file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ) ) );
93
+        if( !file_exists( $file ) ) {
94 94
             return;
95 95
         }
96
-        extract($data);
96
+        extract( $data );
97 97
         include $file;
98 98
     }
99 99
 
100
-    public function url(string $path = ''): string
100
+    public function url( string $path = '' ): string
101 101
     {
102
-        return esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/'));
102
+        return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ) );
103 103
     }
104 104
 }
Please login to merge, or discard this patch.
views/panels/profiler.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <table class="glbb-grid">
4 4
     <thead>
5 5
         <tr>
6
-            <th><?= esc_html__('Timer Name', 'blackbar'); ?></th>
7
-            <th><?= esc_html__('Memory', 'blackbar'); ?></th>
8
-            <th><?= esc_html__('Start', 'blackbar'); ?></th>
9
-            <th><?= esc_html__('Stop', 'blackbar'); ?></th>
10
-            <th><?= esc_html__('Total', 'blackbar'); ?></th>
6
+            <th><?= esc_html__( 'Timer Name', 'blackbar' ); ?></th>
7
+            <th><?= esc_html__( 'Memory', 'blackbar' ); ?></th>
8
+            <th><?= esc_html__( 'Start', 'blackbar' ); ?></th>
9
+            <th><?= esc_html__( 'Stop', 'blackbar' ); ?></th>
10
+            <th><?= esc_html__( 'Total', 'blackbar' ); ?></th>
11 11
         </tr>
12 12
     </thead>
13 13
     <tbody>
14
-        <?php foreach ($profiler->entries() as $entry) : ?>
14
+        <?php foreach( $profiler->entries() as $entry ) : ?>
15 15
             <tr>
16
-                <td><?= esc_html($entry['name']); ?></td>
17
-                <td><?= esc_html($entry['memory']); ?> KB</td>
18
-                <td><?= esc_html($entry['start']); ?></td>
19
-                <td><?= esc_html($entry['stop']); ?></td>
20
-                <td><?= esc_html($entry['time']); ?></td>
16
+                <td><?= esc_html( $entry[ 'name' ] ); ?></td>
17
+                <td><?= esc_html( $entry[ 'memory' ] ); ?> KB</td>
18
+                <td><?= esc_html( $entry[ 'start' ] ); ?></td>
19
+                <td><?= esc_html( $entry[ 'stop' ] ); ?></td>
20
+                <td><?= esc_html( $entry[ 'time' ] ); ?></td>
21 21
             </tr>
22 22
         <?php endforeach; ?>
23 23
     </tbody>
Please login to merge, or discard this patch.