Passed
Push — main ( cae36e...7a0c69 )
by Paul
03:59
created
compatibility.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
  * @see https://docs.gravityforms.com/gform_noconflict_scripts/
8 8
  */
9 9
 add_filter('gform_noconflict_scripts', function (array $scripts) {
10
-    $scripts[] = 'blackbar';
11
-    return $scripts;
10
+	$scripts[] = 'blackbar';
11
+	return $scripts;
12 12
 });
13 13
 
14 14
 /*
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @see https://docs.gravityforms.com/gform_noconflict_styles/
17 17
  */
18 18
 add_filter('gform_noconflict_styles', function (array $styles) {
19
-    $styles[] = 'blackbar';
20
-    $styles[] = 'blackbar-syntax';
21
-    return $styles;
19
+	$styles[] = 'blackbar';
20
+	$styles[] = 'blackbar-syntax';
21
+	return $styles;
22 22
 });
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-defined('WPINC') || exit;
3
+defined( 'WPINC' ) || exit;
4 4
 
5 5
 /*
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) {
10
-    $scripts[] = 'blackbar';
9
+add_filter( 'gform_noconflict_scripts', function( array $scripts ) {
10
+    $scripts[ ] = 'blackbar';
11 11
     return $scripts;
12 12
 });
13 13
 
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
  * @return array
16 16
  * @see https://docs.gravityforms.com/gform_noconflict_styles/
17 17
  */
18
-add_filter('gform_noconflict_styles', function (array $styles) {
19
-    $styles[] = 'blackbar';
20
-    $styles[] = 'blackbar-syntax';
18
+add_filter( 'gform_noconflict_styles', function( array $styles ) {
19
+    $styles[ ] = 'blackbar';
20
+    $styles[ ] = 'blackbar-syntax';
21 21
     return $styles;
22 22
 });
Please login to merge, or discard this patch.
activate.php 3 patches
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -8,141 +8,141 @@
 block discarded – undo
8 8
  */
9 9
 class GL_Plugin_Check_v6
10 10
 {
11
-    const MIN_PHP_VERSION = '7.2';
12
-    const MIN_WORDPRESS_VERSION = '5.8';
11
+	const MIN_PHP_VERSION = '7.2';
12
+	const MIN_WORDPRESS_VERSION = '5.8';
13 13
 
14
-    /**
15
-     * @var array
16
-     */
17
-    public $versions;
14
+	/**
15
+	 * @var array
16
+	 */
17
+	public $versions;
18 18
 
19
-    /**
20
-     * @var string
21
-     */
22
-    protected $file;
19
+	/**
20
+	 * @var string
21
+	 */
22
+	protected $file;
23 23
 
24
-    /**
25
-     * @param string $file
26
-     */
27
-    public function __construct($file)
28
-    {
29
-        $this->file = realpath($file);
30
-        $versionRequirements = get_file_data($this->file, [
31
-            'php' => 'Requires PHP',
32
-            'wordpress' => 'Requires at least',
33
-        ]);
34
-        $this->versions = wp_parse_args(array_filter($versionRequirements), [
35
-            'php' => static::MIN_PHP_VERSION,
36
-            'wordpress' => static::MIN_WORDPRESS_VERSION,
37
-        ]);
38
-    }
24
+	/**
25
+	 * @param string $file
26
+	 */
27
+	public function __construct($file)
28
+	{
29
+		$this->file = realpath($file);
30
+		$versionRequirements = get_file_data($this->file, [
31
+			'php' => 'Requires PHP',
32
+			'wordpress' => 'Requires at least',
33
+		]);
34
+		$this->versions = wp_parse_args(array_filter($versionRequirements), [
35
+			'php' => static::MIN_PHP_VERSION,
36
+			'wordpress' => static::MIN_WORDPRESS_VERSION,
37
+		]);
38
+	}
39 39
 
40
-    /**
41
-     * @return bool
42
-     */
43
-    public function canProceed()
44
-    {
45
-        if ($this->isValid()) {
46
-            return true;
47
-        }
48
-        add_action('activated_plugin', [$this, 'deactivate']);
49
-        add_action('admin_notices', [$this, 'deactivate']);
50
-        return false;
51
-    }
40
+	/**
41
+	 * @return bool
42
+	 */
43
+	public function canProceed()
44
+	{
45
+		if ($this->isValid()) {
46
+			return true;
47
+		}
48
+		add_action('activated_plugin', [$this, 'deactivate']);
49
+		add_action('admin_notices', [$this, 'deactivate']);
50
+		return false;
51
+	}
52 52
 
53
-    /**
54
-     * @return bool
55
-     */
56
-    public function isPhpValid()
57
-    {
58
-        return version_compare(PHP_VERSION, $this->versions['php'], '>=');
59
-    }
53
+	/**
54
+	 * @return bool
55
+	 */
56
+	public function isPhpValid()
57
+	{
58
+		return version_compare(PHP_VERSION, $this->versions['php'], '>=');
59
+	}
60 60
 
61
-    /**
62
-     * @return bool
63
-     */
64
-    public function isValid()
65
-    {
66
-        return $this->isPhpValid() && $this->isWpValid();
67
-    }
61
+	/**
62
+	 * @return bool
63
+	 */
64
+	public function isValid()
65
+	{
66
+		return $this->isPhpValid() && $this->isWpValid();
67
+	}
68 68
 
69
-    /**
70
-     * @return bool
71
-     */
72
-    public function isWpValid()
73
-    {
74
-        global $wp_version;
75
-        return version_compare($wp_version, $this->versions['wordpress'], '>=');
76
-    }
69
+	/**
70
+	 * @return bool
71
+	 */
72
+	public function isWpValid()
73
+	{
74
+		global $wp_version;
75
+		return version_compare($wp_version, $this->versions['wordpress'], '>=');
76
+	}
77 77
 
78
-    /**
79
-     * @param string $plugin
80
-     * @return void
81
-     */
82
-    public function deactivate($plugin)
83
-    {
84
-        if ($this->isValid()) {
85
-            return;
86
-        }
87
-        $pluginSlug = plugin_basename($this->file);
88
-        if ($plugin == $pluginSlug) {
89
-            $this->redirect(); // exit
90
-        }
91
-        $pluginData = get_file_data($this->file, ['name' => 'Plugin Name'], 'plugin');
92
-        deactivate_plugins($pluginSlug);
93
-        $this->printNotice($pluginData['name']);
94
-    }
78
+	/**
79
+	 * @param string $plugin
80
+	 * @return void
81
+	 */
82
+	public function deactivate($plugin)
83
+	{
84
+		if ($this->isValid()) {
85
+			return;
86
+		}
87
+		$pluginSlug = plugin_basename($this->file);
88
+		if ($plugin == $pluginSlug) {
89
+			$this->redirect(); // exit
90
+		}
91
+		$pluginData = get_file_data($this->file, ['name' => 'Plugin Name'], 'plugin');
92
+		deactivate_plugins($pluginSlug);
93
+		$this->printNotice($pluginData['name']);
94
+	}
95 95
 
96
-    /**
97
-     * @return array
98
-     */
99
-    protected function getMessages()
100
-    {
101
-        return [
102
-            'notice' => _x('The %s plugin was deactivated.', 'admin-text', 'blackbar'),
103
-            'php_version' => _x('PHP version', 'admin-text', 'blackbar'),
104
-            'rollback' => _x('You can use the %s plugin to restore %s to the previous version.', 'admin-text', 'blackbar'),
105
-            'update_php' => _x('Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'admin-text', 'blackbar'),
106
-            'update_wp' => _x('Update WordPress', 'admin-text', 'blackbar'),
107
-            'wp_version' => _x('WordPress version', 'admin-text', 'blackbar'),
108
-            'wrong_version' => _x('This plugin requires %s or greater in order to work properly.', 'admin-text', 'blackbar'),
109
-        ];
110
-    }
96
+	/**
97
+	 * @return array
98
+	 */
99
+	protected function getMessages()
100
+	{
101
+		return [
102
+			'notice' => _x('The %s plugin was deactivated.', 'admin-text', 'blackbar'),
103
+			'php_version' => _x('PHP version', 'admin-text', 'blackbar'),
104
+			'rollback' => _x('You can use the %s plugin to restore %s to the previous version.', 'admin-text', 'blackbar'),
105
+			'update_php' => _x('Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'admin-text', 'blackbar'),
106
+			'update_wp' => _x('Update WordPress', 'admin-text', 'blackbar'),
107
+			'wp_version' => _x('WordPress version', 'admin-text', 'blackbar'),
108
+			'wrong_version' => _x('This plugin requires %s or greater in order to work properly.', 'admin-text', 'blackbar'),
109
+		];
110
+	}
111 111
 
112
-    /**
113
-     * @param string $pluginName
114
-     * @return void
115
-     */
116
-    protected function printNotice($pluginName)
117
-    {
118
-        $noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>';
119
-        $messages = $this->getMessages();
120
-        $rollbackMessage = sprintf('<strong>'.$messages['rollback'].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/" target="_blank">WP Rollback</a>', $pluginName);
121
-        if (!$this->isPhpValid()) {
122
-            printf($noticeTemplate,
123
-                sprintf($messages['notice'], $pluginName),
124
-                sprintf($messages['wrong_version'], $messages['php_version'].' '.$this->versions['php']),
125
-                sprintf($messages['update_php'], PHP_VERSION).'</p><p>'.$rollbackMessage
126
-            );
127
-        } elseif (!$this->isWpValid()) {
128
-            printf($noticeTemplate,
129
-                sprintf($messages['notice'], $pluginName),
130
-                sprintf($messages['wrong_version'], $messages['wp_version'].' '.$this->versions['wordpress']),
131
-                $rollbackMessage.'</p><p>'.sprintf('<a href="%s">%s</a>', admin_url('update-core.php'), $messages['update_wp'])
132
-            );
133
-        }
134
-    }
112
+	/**
113
+	 * @param string $pluginName
114
+	 * @return void
115
+	 */
116
+	protected function printNotice($pluginName)
117
+	{
118
+		$noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>';
119
+		$messages = $this->getMessages();
120
+		$rollbackMessage = sprintf('<strong>'.$messages['rollback'].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/" target="_blank">WP Rollback</a>', $pluginName);
121
+		if (!$this->isPhpValid()) {
122
+			printf($noticeTemplate,
123
+				sprintf($messages['notice'], $pluginName),
124
+				sprintf($messages['wrong_version'], $messages['php_version'].' '.$this->versions['php']),
125
+				sprintf($messages['update_php'], PHP_VERSION).'</p><p>'.$rollbackMessage
126
+			);
127
+		} elseif (!$this->isWpValid()) {
128
+			printf($noticeTemplate,
129
+				sprintf($messages['notice'], $pluginName),
130
+				sprintf($messages['wrong_version'], $messages['wp_version'].' '.$this->versions['wordpress']),
131
+				$rollbackMessage.'</p><p>'.sprintf('<a href="%s">%s</a>', admin_url('update-core.php'), $messages['update_wp'])
132
+			);
133
+		}
134
+	}
135 135
 
136
-    /**
137
-     * @return void
138
-     */
139
-    protected function redirect()
140
-    {
141
-        wp_safe_redirect(self_admin_url(sprintf('plugins.php?plugin_status=%s&paged=%s&s=%s',
142
-            filter_input(INPUT_GET, 'plugin_status'),
143
-            filter_input(INPUT_GET, 'paged'),
144
-            filter_input(INPUT_GET, 's')
145
-        )));
146
-        exit;
147
-    }
136
+	/**
137
+	 * @return void
138
+	 */
139
+	protected function redirect()
140
+	{
141
+		wp_safe_redirect(self_admin_url(sprintf('plugins.php?plugin_status=%s&paged=%s&s=%s',
142
+			filter_input(INPUT_GET, 'plugin_status'),
143
+			filter_input(INPUT_GET, 'paged'),
144
+			filter_input(INPUT_GET, 's')
145
+		)));
146
+		exit;
147
+	}
148 148
 }
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-defined('ABSPATH') || exit;
3
+defined( 'ABSPATH' ) || exit;
4 4
 
5 5
 /**
6 6
  * Check for minimum system requirements on plugin activation.
@@ -24,17 +24,17 @@  discard block
 block discarded – undo
24 24
     /**
25 25
      * @param string $file
26 26
      */
27
-    public function __construct($file)
27
+    public function __construct( $file )
28 28
     {
29
-        $this->file = realpath($file);
30
-        $versionRequirements = get_file_data($this->file, [
29
+        $this->file = realpath( $file );
30
+        $versionRequirements = get_file_data( $this->file, [
31 31
             'php' => 'Requires PHP',
32 32
             'wordpress' => 'Requires at least',
33
-        ]);
34
-        $this->versions = wp_parse_args(array_filter($versionRequirements), [
33
+        ] );
34
+        $this->versions = wp_parse_args( array_filter( $versionRequirements ), [
35 35
             'php' => static::MIN_PHP_VERSION,
36 36
             'wordpress' => static::MIN_WORDPRESS_VERSION,
37
-        ]);
37
+        ] );
38 38
     }
39 39
 
40 40
     /**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function canProceed()
44 44
     {
45
-        if ($this->isValid()) {
45
+        if( $this->isValid() ) {
46 46
             return true;
47 47
         }
48
-        add_action('activated_plugin', [$this, 'deactivate']);
49
-        add_action('admin_notices', [$this, 'deactivate']);
48
+        add_action( 'activated_plugin', [ $this, 'deactivate' ] );
49
+        add_action( 'admin_notices', [ $this, 'deactivate' ] );
50 50
         return false;
51 51
     }
52 52
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function isPhpValid()
57 57
     {
58
-        return version_compare(PHP_VERSION, $this->versions['php'], '>=');
58
+        return version_compare( PHP_VERSION, $this->versions[ 'php' ], '>=' );
59 59
     }
60 60
 
61 61
     /**
@@ -72,25 +72,25 @@  discard block
 block discarded – undo
72 72
     public function isWpValid()
73 73
     {
74 74
         global $wp_version;
75
-        return version_compare($wp_version, $this->versions['wordpress'], '>=');
75
+        return version_compare( $wp_version, $this->versions[ 'wordpress' ], '>=' );
76 76
     }
77 77
 
78 78
     /**
79 79
      * @param string $plugin
80 80
      * @return void
81 81
      */
82
-    public function deactivate($plugin)
82
+    public function deactivate( $plugin )
83 83
     {
84
-        if ($this->isValid()) {
84
+        if( $this->isValid() ) {
85 85
             return;
86 86
         }
87
-        $pluginSlug = plugin_basename($this->file);
88
-        if ($plugin == $pluginSlug) {
87
+        $pluginSlug = plugin_basename( $this->file );
88
+        if( $plugin == $pluginSlug ) {
89 89
             $this->redirect(); // exit
90 90
         }
91
-        $pluginData = get_file_data($this->file, ['name' => 'Plugin Name'], 'plugin');
92
-        deactivate_plugins($pluginSlug);
93
-        $this->printNotice($pluginData['name']);
91
+        $pluginData = get_file_data( $this->file, [ 'name' => 'Plugin Name' ], 'plugin' );
92
+        deactivate_plugins( $pluginSlug );
93
+        $this->printNotice( $pluginData[ 'name' ] );
94 94
     }
95 95
 
96 96
     /**
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
     protected function getMessages()
100 100
     {
101 101
         return [
102
-            'notice' => _x('The %s plugin was deactivated.', 'admin-text', 'blackbar'),
103
-            'php_version' => _x('PHP version', 'admin-text', 'blackbar'),
104
-            'rollback' => _x('You can use the %s plugin to restore %s to the previous version.', 'admin-text', 'blackbar'),
105
-            'update_php' => _x('Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'admin-text', 'blackbar'),
106
-            'update_wp' => _x('Update WordPress', 'admin-text', 'blackbar'),
107
-            'wp_version' => _x('WordPress version', 'admin-text', 'blackbar'),
108
-            'wrong_version' => _x('This plugin requires %s or greater in order to work properly.', 'admin-text', 'blackbar'),
102
+            'notice' => _x( 'The %s plugin was deactivated.', 'admin-text', 'blackbar' ),
103
+            'php_version' => _x( 'PHP version', 'admin-text', 'blackbar' ),
104
+            'rollback' => _x( 'You can use the %s plugin to restore %s to the previous version.', 'admin-text', 'blackbar' ),
105
+            'update_php' => _x( 'Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'admin-text', 'blackbar' ),
106
+            'update_wp' => _x( 'Update WordPress', 'admin-text', 'blackbar' ),
107
+            'wp_version' => _x( 'WordPress version', 'admin-text', 'blackbar' ),
108
+            'wrong_version' => _x( 'This plugin requires %s or greater in order to work properly.', 'admin-text', 'blackbar' ),
109 109
         ];
110 110
     }
111 111
 
@@ -113,22 +113,22 @@  discard block
 block discarded – undo
113 113
      * @param string $pluginName
114 114
      * @return void
115 115
      */
116
-    protected function printNotice($pluginName)
116
+    protected function printNotice( $pluginName )
117 117
     {
118 118
         $noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>';
119 119
         $messages = $this->getMessages();
120
-        $rollbackMessage = sprintf('<strong>'.$messages['rollback'].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/" target="_blank">WP Rollback</a>', $pluginName);
121
-        if (!$this->isPhpValid()) {
122
-            printf($noticeTemplate,
123
-                sprintf($messages['notice'], $pluginName),
124
-                sprintf($messages['wrong_version'], $messages['php_version'].' '.$this->versions['php']),
125
-                sprintf($messages['update_php'], PHP_VERSION).'</p><p>'.$rollbackMessage
120
+        $rollbackMessage = sprintf( '<strong>' . $messages[ 'rollback' ] . '</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/" target="_blank">WP Rollback</a>', $pluginName );
121
+        if( !$this->isPhpValid() ) {
122
+            printf( $noticeTemplate,
123
+                sprintf( $messages[ 'notice' ], $pluginName ),
124
+                sprintf( $messages[ 'wrong_version' ], $messages[ 'php_version' ] . ' ' . $this->versions[ 'php' ] ),
125
+                sprintf( $messages[ 'update_php' ], PHP_VERSION ) . '</p><p>' . $rollbackMessage
126 126
             );
127
-        } elseif (!$this->isWpValid()) {
128
-            printf($noticeTemplate,
129
-                sprintf($messages['notice'], $pluginName),
130
-                sprintf($messages['wrong_version'], $messages['wp_version'].' '.$this->versions['wordpress']),
131
-                $rollbackMessage.'</p><p>'.sprintf('<a href="%s">%s</a>', admin_url('update-core.php'), $messages['update_wp'])
127
+        } elseif( !$this->isWpValid() ) {
128
+            printf( $noticeTemplate,
129
+                sprintf( $messages[ 'notice' ], $pluginName ),
130
+                sprintf( $messages[ 'wrong_version' ], $messages[ 'wp_version' ] . ' ' . $this->versions[ 'wordpress' ] ),
131
+                $rollbackMessage . '</p><p>' . sprintf( '<a href="%s">%s</a>', admin_url( 'update-core.php' ), $messages[ 'update_wp' ] )
132 132
             );
133 133
         }
134 134
     }
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
      */
139 139
     protected function redirect()
140 140
     {
141
-        wp_safe_redirect(self_admin_url(sprintf('plugins.php?plugin_status=%s&paged=%s&s=%s',
142
-            filter_input(INPUT_GET, 'plugin_status'),
143
-            filter_input(INPUT_GET, 'paged'),
144
-            filter_input(INPUT_GET, 's')
145
-        )));
141
+        wp_safe_redirect( self_admin_url( sprintf( 'plugins.php?plugin_status=%s&paged=%s&s=%s',
142
+            filter_input( INPUT_GET, 'plugin_status' ),
143
+            filter_input( INPUT_GET, 'paged' ),
144
+            filter_input( INPUT_GET, 's' )
145
+        ) ) );
146 146
         exit;
147 147
     }
148 148
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -124,7 +124,8 @@
 block discarded – undo
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']),
Please login to merge, or discard this patch.
blackbar.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@
 block discarded – undo
20 20
 defined('ABSPATH') || exit;
21 21
 
22 22
 if (!class_exists('GL_Plugin_Check_v6')) {
23
-    require_once __DIR__.'/activate.php';
23
+	require_once __DIR__.'/activate.php';
24 24
 }
25 25
 if ((new GL_Plugin_Check_v6(__FILE__))->canProceed()) {
26
-    require_once __DIR__.'/autoload.php';
27
-    require_once __DIR__.'/compatibility.php';
28
-    if (!defined('SAVEQUERIES')) {
29
-        define('SAVEQUERIES', 1);
30
-    }
31
-    GeminiLabs\BlackBar\Application::load()->init();
26
+	require_once __DIR__.'/autoload.php';
27
+	require_once __DIR__.'/compatibility.php';
28
+	if (!defined('SAVEQUERIES')) {
29
+		define('SAVEQUERIES', 1);
30
+	}
31
+	GeminiLabs\BlackBar\Application::load()->init();
32 32
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,16 +17,16 @@
 block discarded – undo
17 17
  * Text Domain:       blackbar
18 18
  * Domain Path:       languages
19 19
  */
20
-defined('ABSPATH') || exit;
20
+defined( 'ABSPATH' ) || exit;
21 21
 
22
-if (!class_exists('GL_Plugin_Check_v6')) {
23
-    require_once __DIR__.'/activate.php';
22
+if( !class_exists( 'GL_Plugin_Check_v6' ) ) {
23
+    require_once __DIR__ . '/activate.php';
24 24
 }
25
-if ((new GL_Plugin_Check_v6(__FILE__))->canProceed()) {
26
-    require_once __DIR__.'/autoload.php';
27
-    require_once __DIR__.'/compatibility.php';
28
-    if (!defined('SAVEQUERIES')) {
29
-        define('SAVEQUERIES', 1);
25
+if( ( new GL_Plugin_Check_v6( __FILE__ ) )->canProceed() ) {
26
+    require_once __DIR__ . '/autoload.php';
27
+    require_once __DIR__ . '/compatibility.php';
28
+    if( !defined( 'SAVEQUERIES' ) ) {
29
+        define( 'SAVEQUERIES', 1 );
30 30
     }
31 31
     GeminiLabs\BlackBar\Application::load()->init();
32 32
 }
Please login to merge, or discard this patch.
plugin/Modules/Templates.php 3 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,12 +30,15 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -6,39 +6,39 @@
 block discarded – undo
6 6
 
7 7
 class Templates extends Module
8 8
 {
9
-    public function entries(): array
10
-    {
11
-        if (!empty($this->entries)) {
12
-            return $this->entries;
13
-        }
14
-        if (class_exists('\GeminiLabs\Castor\Facades\Development')
15
-            && class_exists('\GeminiLabs\Castor\Helpers\Development')
16
-            && method_exists('\GeminiLabs\Castor\Helpers\Development', 'templatePaths')) { // @phpstan-ignore-line
17
-            $this->entries = \GeminiLabs\Castor\Facades\Development::templatePaths();
18
-        } else {
19
-            $files = array_values(array_filter(get_included_files(), function ($file) {
20
-                $bool = false !== strpos($file, '/themes/') && false === strpos($file, '/functions.php');
21
-                return (bool) apply_filters('blackbar/templates/file', $bool, $file);
22
-            }));
23
-            $this->entries = array_map(function ($file) {
24
-                return str_replace(trailingslashit(WP_CONTENT_DIR), '', $file);
25
-            }, $files);
26
-        }
27
-        return $this->entries;
28
-    }
9
+	public function entries(): array
10
+	{
11
+		if (!empty($this->entries)) {
12
+			return $this->entries;
13
+		}
14
+		if (class_exists('\GeminiLabs\Castor\Facades\Development')
15
+			&& class_exists('\GeminiLabs\Castor\Helpers\Development')
16
+			&& method_exists('\GeminiLabs\Castor\Helpers\Development', 'templatePaths')) { // @phpstan-ignore-line
17
+			$this->entries = \GeminiLabs\Castor\Facades\Development::templatePaths();
18
+		} else {
19
+			$files = array_values(array_filter(get_included_files(), function ($file) {
20
+				$bool = false !== strpos($file, '/themes/') && false === strpos($file, '/functions.php');
21
+				return (bool) apply_filters('blackbar/templates/file', $bool, $file);
22
+			}));
23
+			$this->entries = array_map(function ($file) {
24
+				return str_replace(trailingslashit(WP_CONTENT_DIR), '', $file);
25
+			}, $files);
26
+		}
27
+		return $this->entries;
28
+	}
29 29
 
30
-    public function hasEntries(): bool
31
-    {
32
-        return !empty($this->entries());
33
-    }
30
+	public function hasEntries(): bool
31
+	{
32
+		return !empty($this->entries());
33
+	}
34 34
 
35
-    public function isVisible(): bool
36
-    {
37
-        return !is_admin() && $this->hasEntries();
38
-    }
35
+	public function isVisible(): bool
36
+	{
37
+		return !is_admin() && $this->hasEntries();
38
+	}
39 39
 
40
-    public function label(): string
41
-    {
42
-        return __('Templates', 'blackbar');
43
-    }
40
+	public function label(): string
41
+	{
42
+		return __('Templates', 'blackbar');
43
+	}
44 44
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -8,28 +8,28 @@  discard block
 block discarded – undo
8 8
 {
9 9
     public function entries(): array
10 10
     {
11
-        if (!empty($this->entries)) {
11
+        if( !empty( $this->entries ) ) {
12 12
             return $this->entries;
13 13
         }
14
-        if (class_exists('\GeminiLabs\Castor\Facades\Development')
15
-            && class_exists('\GeminiLabs\Castor\Helpers\Development')
16
-            && method_exists('\GeminiLabs\Castor\Helpers\Development', 'templatePaths')) { // @phpstan-ignore-line
14
+        if( class_exists( '\GeminiLabs\Castor\Facades\Development' )
15
+            && class_exists( '\GeminiLabs\Castor\Helpers\Development' )
16
+            && method_exists( '\GeminiLabs\Castor\Helpers\Development', 'templatePaths' ) ) { // @phpstan-ignore-line
17 17
             $this->entries = \GeminiLabs\Castor\Facades\Development::templatePaths();
18 18
         } else {
19
-            $files = array_values(array_filter(get_included_files(), function ($file) {
20
-                $bool = false !== strpos($file, '/themes/') && false === strpos($file, '/functions.php');
21
-                return (bool) apply_filters('blackbar/templates/file', $bool, $file);
22
-            }));
23
-            $this->entries = array_map(function ($file) {
24
-                return str_replace(trailingslashit(WP_CONTENT_DIR), '', $file);
25
-            }, $files);
19
+            $files = array_values( array_filter( get_included_files(), function( $file ) {
20
+                $bool = false !== strpos( $file, '/themes/' ) && false === strpos( $file, '/functions.php' );
21
+                return (bool) apply_filters( 'blackbar/templates/file', $bool, $file );
22
+            }) );
23
+            $this->entries = array_map( function( $file ) {
24
+                return str_replace( trailingslashit( WP_CONTENT_DIR ), '', $file );
25
+            }, $files );
26 26
         }
27 27
         return $this->entries;
28 28
     }
29 29
 
30 30
     public function hasEntries(): bool
31 31
     {
32
-        return !empty($this->entries());
32
+        return !empty( $this->entries() );
33 33
     }
34 34
 
35 35
     public function isVisible(): bool
@@ -39,6 +39,6 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function label(): string
41 41
     {
42
-        return __('Templates', 'blackbar');
42
+        return __( 'Templates', 'blackbar' );
43 43
     }
44 44
 }
Please login to merge, or discard this patch.
plugin/Application.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,8 @@
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -11,94 +11,94 @@
 block discarded – undo
11 11
 
12 12
 final class Application
13 13
 {
14
-    public const CONSOLE_HOOK = 'console';
15
-    public const ID = 'blackbar';
16
-    public const PROFILER_START_HOOK = 'timer:start';
17
-    public const PROFILER_STOP_HOOK = 'timer:stop';
14
+	public const CONSOLE_HOOK = 'console';
15
+	public const ID = 'blackbar';
16
+	public const PROFILER_START_HOOK = 'timer:start';
17
+	public const PROFILER_STOP_HOOK = 'timer:stop';
18 18
 
19
-    public $console;
20
-    public $file;
21
-    public $globals;
22
-    public $hooks;
23
-    public $profiler;
24
-    public $queries;
25
-    public $templates;
19
+	public $console;
20
+	public $file;
21
+	public $globals;
22
+	public $hooks;
23
+	public $profiler;
24
+	public $queries;
25
+	public $templates;
26 26
 
27
-    private static $instance;
27
+	private static $instance;
28 28
 
29
-    public function __construct()
30
-    {
31
-        $file = wp_normalize_path((new \ReflectionClass($this))->getFileName());
32
-        $this->console = new Console($this);
33
-        $this->file = str_replace('plugin/Application', static::ID, $file);
34
-        $this->globals = new Globals($this);
35
-        $this->hooks = new Hooks($this);
36
-        $this->profiler = new Profiler($this);
37
-        $this->queries = new Queries($this);
38
-        $this->templates = new Templates($this);
39
-    }
29
+	public function __construct()
30
+	{
31
+		$file = wp_normalize_path((new \ReflectionClass($this))->getFileName());
32
+		$this->console = new Console($this);
33
+		$this->file = str_replace('plugin/Application', static::ID, $file);
34
+		$this->globals = new Globals($this);
35
+		$this->hooks = new Hooks($this);
36
+		$this->profiler = new Profiler($this);
37
+		$this->queries = new Queries($this);
38
+		$this->templates = new Templates($this);
39
+	}
40 40
 
41
-    public function errorHandler(int $errno, string $message, string $file, int $line): bool
42
-    {
43
-        $path = explode(ABSPATH, $file);
44
-        $location = sprintf('%s:%s', array_pop($path), $line);
45
-        $this->console->store($message, (string) $errno, $location);
46
-        return true;
47
-    }
41
+	public function errorHandler(int $errno, string $message, string $file, int $line): bool
42
+	{
43
+		$path = explode(ABSPATH, $file);
44
+		$location = sprintf('%s:%s', array_pop($path), $line);
45
+		$this->console->store($message, (string) $errno, $location);
46
+		return true;
47
+	}
48 48
 
49
-    public function init(): void
50
-    {
51
-        $controller = new Controller($this);
52
-        add_action('all', [$controller, 'initConsole']);
53
-        add_action('all', [$controller, 'initHooks']);
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
-                return;
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']);
67
-        });
68
-        set_error_handler([$this, 'errorHandler'], E_ALL | E_STRICT);
69
-    }
49
+	public function init(): void
50
+	{
51
+		$controller = new Controller($this);
52
+		add_action('all', [$controller, 'initConsole']);
53
+		add_action('all', [$controller, 'initHooks']);
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
+				return;
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']);
67
+		});
68
+		set_error_handler([$this, 'errorHandler'], E_ALL | E_STRICT);
69
+	}
70 70
 
71
-    /**
72
-     * @return static
73
-     */
74
-    public static function load()
75
-    {
76
-        if (empty(self::$instance)) {
77
-            self::$instance = new static();
78
-        }
79
-        return self::$instance;
80
-    }
71
+	/**
72
+	 * @return static
73
+	 */
74
+	public static function load()
75
+	{
76
+		if (empty(self::$instance)) {
77
+			self::$instance = new static();
78
+		}
79
+		return self::$instance;
80
+	}
81 81
 
82
-    public function path(string $file = '', bool $realpath = true): string
83
-    {
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), '/');
88
-    }
82
+	public function path(string $file = '', bool $realpath = true): string
83
+	{
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), '/');
88
+	}
89 89
 
90
-    public function render(string $view, array $data = []): void
91
-    {
92
-        $file = $this->path(sprintf('views/%s.php', str_replace('.php', '', $view)));
93
-        if (!file_exists($file)) {
94
-            return;
95
-        }
96
-        extract($data);
97
-        include $file;
98
-    }
90
+	public function render(string $view, array $data = []): void
91
+	{
92
+		$file = $this->path(sprintf('views/%s.php', str_replace('.php', '', $view)));
93
+		if (!file_exists($file)) {
94
+			return;
95
+		}
96
+		extract($data);
97
+		include $file;
98
+	}
99 99
 
100
-    public function url(string $path = ''): string
101
-    {
102
-        return esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/'));
103
-    }
100
+	public function url(string $path = ''): string
101
+	{
102
+		return esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/'));
103
+	}
104 104
 }
Please login to merge, or discard this 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->console = new Console($this);
33
-        $this->file = str_replace('plugin/Application', static::ID, $file);
34
-        $this->globals = new Globals($this);
35
-        $this->hooks = new Hooks($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->console = new Console( $this );
33
+        $this->file = str_replace( 'plugin/Application', static::ID, $file );
34
+        $this->globals = new Globals( $this );
35
+        $this->hooks = new Hooks( $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, 'initConsole']);
53
-        add_action('all', [$controller, 'initHooks']);
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, 'initConsole' ] );
53
+        add_action( 'all', [ $controller, 'initHooks' ] );
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/queries.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,9 +8,12 @@
 block discarded – undo
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>
Please login to merge, or discard this 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') || exit; ?>
1
+<?php defined( 'WPINC' ) || exit; ?>
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 ($module->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_formatted']); ?>"><div class="glbb-row-toggle dashicons-before dashicons-arrow-right"><?= esc_html($entry['time_formatted']); ?></div></td>
25
-                    <td data-sql><pre><code class="language-sql"><?= esc_html($entry['sql']); ?></code></pre></td>
22
+            <?php foreach( $module->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_formatted' ] ); ?>"><div class="glbb-row-toggle dashicons-before dashicons-arrow-right"><?= esc_html( $entry[ 'time_formatted' ] ); ?></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.
plugin/Dump.php 3 patches
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -7,142 +7,142 @@
 block discarded – undo
7 7
  */
8 8
 class Dump
9 9
 {
10
-    public $depth;
11
-    public $ignore;
10
+	public $depth;
11
+	public $ignore;
12 12
 
13
-    protected $level = 0;
14
-    protected $result = [];
15
-    protected $stack = [];
13
+	protected $level = 0;
14
+	protected $result = [];
15
+	protected $stack = [];
16 16
 
17
-    /**
18
-     * @param mixed $value
19
-     */
20
-    public function dump($value, int $depth = 3, array $ignore = []): string
21
-    {
22
-        $this->depth = $depth;
23
-        $this->ignore = $ignore;
24
-        $this->reset();
25
-        $this->inspect($value);
26
-        $result = implode('', $this->result);
27
-        $result = rtrim($result, "\n");
28
-        $this->reset();
29
-        return $result;
30
-    }
17
+	/**
18
+	 * @param mixed $value
19
+	 */
20
+	public function dump($value, int $depth = 3, array $ignore = []): string
21
+	{
22
+		$this->depth = $depth;
23
+		$this->ignore = $ignore;
24
+		$this->reset();
25
+		$this->inspect($value);
26
+		$result = implode('', $this->result);
27
+		$result = rtrim($result, "\n");
28
+		$this->reset();
29
+		return $result;
30
+	}
31 31
 
32
-    protected function formatKey(string $key): string
33
-    {
34
-        $result = [];
35
-        $result[] = str_repeat(' ', $this->level * 4).'[';
36
-        if (is_string($key) && "\0" === $key[0]) {
37
-            $keyParts = explode("\0", $key);
38
-            $result[] = $keyParts[2].(('*' === $keyParts[1]) ? ':protected' : ':private');
39
-        } else {
40
-            $result[] = $key;
41
-        }
42
-        $result[] = '] => ';
43
-        return implode('', $result);
44
-    }
32
+	protected function formatKey(string $key): string
33
+	{
34
+		$result = [];
35
+		$result[] = str_repeat(' ', $this->level * 4).'[';
36
+		if (is_string($key) && "\0" === $key[0]) {
37
+			$keyParts = explode("\0", $key);
38
+			$result[] = $keyParts[2].(('*' === $keyParts[1]) ? ':protected' : ':private');
39
+		} else {
40
+			$result[] = $key;
41
+		}
42
+		$result[] = '] => ';
43
+		return implode('', $result);
44
+	}
45 45
 
46
-    /**
47
-     * @param mixed $subject
48
-     */
49
-    protected function inspect($subject): void
50
-    {
51
-        ++$this->level;
52
-        if ($subject instanceof \Closure) {
53
-            $this->inspectClosure($subject);
54
-        } elseif (is_object($subject)) {
55
-            $this->inspectObject($subject);
56
-        } elseif (is_array($subject)) {
57
-            $this->inspectArray($subject);
58
-        } else {
59
-            $this->inspectPrimitive($subject);
60
-        }
61
-        --$this->level;
62
-    }
46
+	/**
47
+	 * @param mixed $subject
48
+	 */
49
+	protected function inspect($subject): void
50
+	{
51
+		++$this->level;
52
+		if ($subject instanceof \Closure) {
53
+			$this->inspectClosure($subject);
54
+		} elseif (is_object($subject)) {
55
+			$this->inspectObject($subject);
56
+		} elseif (is_array($subject)) {
57
+			$this->inspectArray($subject);
58
+		} else {
59
+			$this->inspectPrimitive($subject);
60
+		}
61
+		--$this->level;
62
+	}
63 63
 
64
-    protected function inspectArray(array $subject): void
65
-    {
66
-        if ($this->level > $this->depth) {
67
-            $this->result[] = "Nested Array\n";
68
-            return;
69
-        }
70
-        if (empty($subject)) {
71
-            $this->result[] = "Array ()\n";
72
-            return;
73
-        }
74
-        $this->result[] = "Array (\n";
75
-        foreach ($subject as $key => $val) {
76
-            if (false === $this->isIgnoredKey($key)) {
77
-                $this->result[] = str_repeat(' ', $this->level * 4).'['.$key.'] => ';
78
-                $this->inspect($val);
79
-            }
80
-        }
81
-        $this->result[] = str_repeat(' ', ($this->level - 1) * 4).")\n";
82
-    }
64
+	protected function inspectArray(array $subject): void
65
+	{
66
+		if ($this->level > $this->depth) {
67
+			$this->result[] = "Nested Array\n";
68
+			return;
69
+		}
70
+		if (empty($subject)) {
71
+			$this->result[] = "Array ()\n";
72
+			return;
73
+		}
74
+		$this->result[] = "Array (\n";
75
+		foreach ($subject as $key => $val) {
76
+			if (false === $this->isIgnoredKey($key)) {
77
+				$this->result[] = str_repeat(' ', $this->level * 4).'['.$key.'] => ';
78
+				$this->inspect($val);
79
+			}
80
+		}
81
+		$this->result[] = str_repeat(' ', ($this->level - 1) * 4).")\n";
82
+	}
83 83
 
84
-    protected function inspectClosure(\Closure $subject): void
85
-    {
86
-        $reflection = new \ReflectionFunction($subject);
87
-        $params = array_map(function ($param) {
88
-            return ($param->isPassedByReference() ? '&$' : '$').$param->name;
89
-        }, $reflection->getParameters());
90
-        $this->result[] = 'Closure ('.implode(', ', $params).') { ... }'."\n";
91
-    }
84
+	protected function inspectClosure(\Closure $subject): void
85
+	{
86
+		$reflection = new \ReflectionFunction($subject);
87
+		$params = array_map(function ($param) {
88
+			return ($param->isPassedByReference() ? '&$' : '$').$param->name;
89
+		}, $reflection->getParameters());
90
+		$this->result[] = 'Closure ('.implode(', ', $params).') { ... }'."\n";
91
+	}
92 92
 
93
-    /**
94
-     * @param object $subject
95
-     */
96
-    protected function inspectObject($subject): void
97
-    {
98
-        $classname = get_class($subject);
99
-        if ($this->level > $this->depth) {
100
-            $this->result[] = 'Nested '.$classname." Object\n";
101
-            return;
102
-        }
103
-        if ($subject instanceof \ArrayObject) {
104
-            $this->result[] = $classname." ArrayObject (\n";
105
-        } else {
106
-            $this->result[] = $classname." Object (\n";
107
-            $subject = (array) $subject;
108
-        }
109
-        foreach ($subject as $key => $val) {
110
-            if (false === $this->isIgnoredKey($key)) {
111
-                $this->result[] = $this->formatKey($key);
112
-                $this->inspect($val);
113
-            }
114
-        }
115
-        $this->result[] = str_repeat(' ', ($this->level - 1) * 4).")\n";
116
-    }
93
+	/**
94
+	 * @param object $subject
95
+	 */
96
+	protected function inspectObject($subject): void
97
+	{
98
+		$classname = get_class($subject);
99
+		if ($this->level > $this->depth) {
100
+			$this->result[] = 'Nested '.$classname." Object\n";
101
+			return;
102
+		}
103
+		if ($subject instanceof \ArrayObject) {
104
+			$this->result[] = $classname." ArrayObject (\n";
105
+		} else {
106
+			$this->result[] = $classname." Object (\n";
107
+			$subject = (array) $subject;
108
+		}
109
+		foreach ($subject as $key => $val) {
110
+			if (false === $this->isIgnoredKey($key)) {
111
+				$this->result[] = $this->formatKey($key);
112
+				$this->inspect($val);
113
+			}
114
+		}
115
+		$this->result[] = str_repeat(' ', ($this->level - 1) * 4).")\n";
116
+	}
117 117
 
118
-    /**
119
-     * @param mixed $subject
120
-     */
121
-    protected function inspectPrimitive($subject): void
122
-    {
123
-        if (true === $subject) {
124
-            $subject = '(bool) true';
125
-        } elseif (false === $subject) {
126
-            $subject = '(bool) false';
127
-        } elseif (null === $subject) {
128
-            $subject = '(null)';
129
-        }
130
-        $this->result[] = $subject."\n";
131
-    }
118
+	/**
119
+	 * @param mixed $subject
120
+	 */
121
+	protected function inspectPrimitive($subject): void
122
+	{
123
+		if (true === $subject) {
124
+			$subject = '(bool) true';
125
+		} elseif (false === $subject) {
126
+			$subject = '(bool) false';
127
+		} elseif (null === $subject) {
128
+			$subject = '(null)';
129
+		}
130
+		$this->result[] = $subject."\n";
131
+	}
132 132
 
133
-    /**
134
-     * @param string $key
135
-     */
136
-    protected function isIgnoredKey($key): bool
137
-    {
138
-        return in_array($key, $this->ignore);
139
-    }
133
+	/**
134
+	 * @param string $key
135
+	 */
136
+	protected function isIgnoredKey($key): bool
137
+	{
138
+		return in_array($key, $this->ignore);
139
+	}
140 140
 
141
-    protected function reset(): void
142
-    {
143
-        $this->level = 0;
144
-        $this->result = [];
145
-        $this->stack = [];
146
-    }
141
+	protected function reset(): void
142
+	{
143
+		$this->level = 0;
144
+		$this->result = [];
145
+		$this->stack = [];
146
+	}
147 147
 }
148 148
 
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -11,138 +11,138 @@
 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
      */
20
-    public function dump($value, int $depth = 3, array $ignore = []): string
20
+    public function dump( $value, int $depth = 3, array $ignore = [ ] ): string
21 21
     {
22 22
         $this->depth = $depth;
23 23
         $this->ignore = $ignore;
24 24
         $this->reset();
25
-        $this->inspect($value);
26
-        $result = implode('', $this->result);
27
-        $result = rtrim($result, "\n");
25
+        $this->inspect( $value );
26
+        $result = implode( '', $this->result );
27
+        $result = rtrim( $result, "\n" );
28 28
         $this->reset();
29 29
         return $result;
30 30
     }
31 31
 
32
-    protected function formatKey(string $key): string
32
+    protected function formatKey( string $key ): string
33 33
     {
34
-        $result = [];
35
-        $result[] = str_repeat(' ', $this->level * 4).'[';
36
-        if (is_string($key) && "\0" === $key[0]) {
37
-            $keyParts = explode("\0", $key);
38
-            $result[] = $keyParts[2].(('*' === $keyParts[1]) ? ':protected' : ':private');
34
+        $result = [ ];
35
+        $result[ ] = str_repeat( ' ', $this->level * 4 ) . '[';
36
+        if( is_string( $key ) && "\0" === $key[ 0 ] ) {
37
+            $keyParts = explode( "\0", $key );
38
+            $result[ ] = $keyParts[ 2 ] . ( ( '*' === $keyParts[ 1 ] ) ? ':protected' : ':private' );
39 39
         } else {
40
-            $result[] = $key;
40
+            $result[ ] = $key;
41 41
         }
42
-        $result[] = '] => ';
43
-        return implode('', $result);
42
+        $result[ ] = '] => ';
43
+        return implode( '', $result );
44 44
     }
45 45
 
46 46
     /**
47 47
      * @param mixed $subject
48 48
      */
49
-    protected function inspect($subject): void
49
+    protected function inspect( $subject ): void
50 50
     {
51 51
         ++$this->level;
52
-        if ($subject instanceof \Closure) {
53
-            $this->inspectClosure($subject);
54
-        } elseif (is_object($subject)) {
55
-            $this->inspectObject($subject);
56
-        } elseif (is_array($subject)) {
57
-            $this->inspectArray($subject);
52
+        if( $subject instanceof \Closure ) {
53
+            $this->inspectClosure( $subject );
54
+        } elseif( is_object( $subject ) ) {
55
+            $this->inspectObject( $subject );
56
+        } elseif( is_array( $subject ) ) {
57
+            $this->inspectArray( $subject );
58 58
         } else {
59
-            $this->inspectPrimitive($subject);
59
+            $this->inspectPrimitive( $subject );
60 60
         }
61 61
         --$this->level;
62 62
     }
63 63
 
64
-    protected function inspectArray(array $subject): void
64
+    protected function inspectArray( array $subject ): void
65 65
     {
66
-        if ($this->level > $this->depth) {
67
-            $this->result[] = "Nested Array\n";
66
+        if( $this->level > $this->depth ) {
67
+            $this->result[ ] = "Nested Array\n";
68 68
             return;
69 69
         }
70
-        if (empty($subject)) {
71
-            $this->result[] = "Array ()\n";
70
+        if( empty( $subject ) ) {
71
+            $this->result[ ] = "Array ()\n";
72 72
             return;
73 73
         }
74
-        $this->result[] = "Array (\n";
75
-        foreach ($subject as $key => $val) {
76
-            if (false === $this->isIgnoredKey($key)) {
77
-                $this->result[] = str_repeat(' ', $this->level * 4).'['.$key.'] => ';
78
-                $this->inspect($val);
74
+        $this->result[ ] = "Array (\n";
75
+        foreach( $subject as $key => $val ) {
76
+            if( false === $this->isIgnoredKey( $key ) ) {
77
+                $this->result[ ] = str_repeat( ' ', $this->level * 4 ) . '[' . $key . '] => ';
78
+                $this->inspect( $val );
79 79
             }
80 80
         }
81
-        $this->result[] = str_repeat(' ', ($this->level - 1) * 4).")\n";
81
+        $this->result[ ] = str_repeat( ' ', ( $this->level - 1 ) * 4 ) . ")\n";
82 82
     }
83 83
 
84
-    protected function inspectClosure(\Closure $subject): void
84
+    protected function inspectClosure( \Closure $subject ): void
85 85
     {
86
-        $reflection = new \ReflectionFunction($subject);
87
-        $params = array_map(function ($param) {
88
-            return ($param->isPassedByReference() ? '&$' : '$').$param->name;
89
-        }, $reflection->getParameters());
90
-        $this->result[] = 'Closure ('.implode(', ', $params).') { ... }'."\n";
86
+        $reflection = new \ReflectionFunction( $subject );
87
+        $params = array_map( function( $param ) {
88
+            return ( $param->isPassedByReference() ? '&$' : '$' ) . $param->name;
89
+        }, $reflection->getParameters() );
90
+        $this->result[ ] = 'Closure (' . implode( ', ', $params ) . ') { ... }' . "\n";
91 91
     }
92 92
 
93 93
     /**
94 94
      * @param object $subject
95 95
      */
96
-    protected function inspectObject($subject): void
96
+    protected function inspectObject( $subject ): void
97 97
     {
98
-        $classname = get_class($subject);
99
-        if ($this->level > $this->depth) {
100
-            $this->result[] = 'Nested '.$classname." Object\n";
98
+        $classname = get_class( $subject );
99
+        if( $this->level > $this->depth ) {
100
+            $this->result[ ] = 'Nested ' . $classname . " Object\n";
101 101
             return;
102 102
         }
103
-        if ($subject instanceof \ArrayObject) {
104
-            $this->result[] = $classname." ArrayObject (\n";
103
+        if( $subject instanceof \ArrayObject ) {
104
+            $this->result[ ] = $classname . " ArrayObject (\n";
105 105
         } else {
106
-            $this->result[] = $classname." Object (\n";
106
+            $this->result[ ] = $classname . " Object (\n";
107 107
             $subject = (array) $subject;
108 108
         }
109
-        foreach ($subject as $key => $val) {
110
-            if (false === $this->isIgnoredKey($key)) {
111
-                $this->result[] = $this->formatKey($key);
112
-                $this->inspect($val);
109
+        foreach( $subject as $key => $val ) {
110
+            if( false === $this->isIgnoredKey( $key ) ) {
111
+                $this->result[ ] = $this->formatKey( $key );
112
+                $this->inspect( $val );
113 113
             }
114 114
         }
115
-        $this->result[] = str_repeat(' ', ($this->level - 1) * 4).")\n";
115
+        $this->result[ ] = str_repeat( ' ', ( $this->level - 1 ) * 4 ) . ")\n";
116 116
     }
117 117
 
118 118
     /**
119 119
      * @param mixed $subject
120 120
      */
121
-    protected function inspectPrimitive($subject): void
121
+    protected function inspectPrimitive( $subject ): void
122 122
     {
123
-        if (true === $subject) {
123
+        if( true === $subject ) {
124 124
             $subject = '(bool) true';
125
-        } elseif (false === $subject) {
125
+        } elseif( false === $subject ) {
126 126
             $subject = '(bool) false';
127
-        } elseif (null === $subject) {
127
+        } elseif( null === $subject ) {
128 128
             $subject = '(null)';
129 129
         }
130
-        $this->result[] = $subject."\n";
130
+        $this->result[ ] = $subject . "\n";
131 131
     }
132 132
 
133 133
     /**
134 134
      * @param string $key
135 135
      */
136
-    protected function isIgnoredKey($key): bool
136
+    protected function isIgnoredKey( $key ): bool
137 137
     {
138
-        return in_array($key, $this->ignore);
138
+        return in_array( $key, $this->ignore );
139 139
     }
140 140
 
141 141
     protected function reset(): void
142 142
     {
143 143
         $this->level = 0;
144
-        $this->result = [];
145
-        $this->stack = [];
144
+        $this->result = [ ];
145
+        $this->stack = [ ];
146 146
     }
147 147
 }
148 148
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,7 +36,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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";
Please login to merge, or discard this patch.
plugin/Modules/Console.php 3 patches
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,7 +74,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -6,112 +6,112 @@
 block discarded – undo
6 6
 
7 7
 class Console extends Module
8 8
 {
9
-    public const ERROR_CODES = [
10
-        E_ERROR => 'error', // 1
11
-        E_WARNING => 'warning', // 2
12
-        E_NOTICE => 'notice', // 8
13
-        E_STRICT => 'strict', // 2048
14
-        E_DEPRECATED => 'deprecated', // 8192
15
-    ];
9
+	public const ERROR_CODES = [
10
+		E_ERROR => 'error', // 1
11
+		E_WARNING => 'warning', // 2
12
+		E_NOTICE => 'notice', // 8
13
+		E_STRICT => 'strict', // 2048
14
+		E_DEPRECATED => 'deprecated', // 8192
15
+	];
16 16
 
17
-    public const MAPPED_ERROR_CODES = [
18
-        'debug' => 0,
19
-        'info' => E_NOTICE,
20
-        'deprecated' => E_DEPRECATED, // 8192
21
-        'error' => E_ERROR, // 1
22
-        'notice' => E_NOTICE, // 8
23
-        'strict' => E_STRICT, // 2048
24
-        'warning' => E_WARNING, // 2
25
-        'critical' => E_ERROR, // 1
26
-        'alert' => E_ERROR, // 1
27
-        'emergency' => E_ERROR, // 1
28
-    ];
17
+	public const MAPPED_ERROR_CODES = [
18
+		'debug' => 0,
19
+		'info' => E_NOTICE,
20
+		'deprecated' => E_DEPRECATED, // 8192
21
+		'error' => E_ERROR, // 1
22
+		'notice' => E_NOTICE, // 8
23
+		'strict' => E_STRICT, // 2048
24
+		'warning' => E_WARNING, // 2
25
+		'critical' => E_ERROR, // 1
26
+		'alert' => E_ERROR, // 1
27
+		'emergency' => E_ERROR, // 1
28
+	];
29 29
 
30
-    public function classes(): string
31
-    {
32
-        $errno = array_unique(wp_list_pluck($this->entries, 'errno'));
33
-        if (in_array(E_ERROR, $errno)) {
34
-            return sprintf('%s glbb-error', $this->id());
35
-        }
36
-        if (in_array(E_WARNING, $errno)) {
37
-            return sprintf('%s glbb-warning', $this->id());
38
-        }
39
-        return $this->id();
40
-    }
30
+	public function classes(): string
31
+	{
32
+		$errno = array_unique(wp_list_pluck($this->entries, 'errno'));
33
+		if (in_array(E_ERROR, $errno)) {
34
+			return sprintf('%s glbb-error', $this->id());
35
+		}
36
+		if (in_array(E_WARNING, $errno)) {
37
+			return sprintf('%s glbb-warning', $this->id());
38
+		}
39
+		return $this->id();
40
+	}
41 41
 
42
-    public function entries(): array
43
-    {
44
-        $entries = [];
45
-        foreach ($this->entries as $entry) {
46
-            $entry['name'] = ucfirst($entry['errname']);
47
-            if ($entry['count'] > 1) {
48
-                $entry['name'] = sprintf('%s (%s)', $entry['name'], $entry['count']);
49
-            }
50
-            $entries[] = $entry;
51
-        }
52
-        return $entries;
53
-    }
42
+	public function entries(): array
43
+	{
44
+		$entries = [];
45
+		foreach ($this->entries as $entry) {
46
+			$entry['name'] = ucfirst($entry['errname']);
47
+			if ($entry['count'] > 1) {
48
+				$entry['name'] = sprintf('%s (%s)', $entry['name'], $entry['count']);
49
+			}
50
+			$entries[] = $entry;
51
+		}
52
+		return $entries;
53
+	}
54 54
 
55
-    public function info(): string
56
-    {
57
-        $counts = array_count_values(wp_list_pluck($this->entries, 'errno'));
58
-        $entryCount = count($this->entries);
59
-        if (!empty($counts[E_ERROR])) {
60
-            return sprintf('%d, %d!', $entryCount, $counts[E_ERROR]);
61
-        }
62
-        if ($entryCount > 0) {
63
-            return (string) $entryCount;
64
-        }
65
-        return '';
66
-    }
55
+	public function info(): string
56
+	{
57
+		$counts = array_count_values(wp_list_pluck($this->entries, 'errno'));
58
+		$entryCount = count($this->entries);
59
+		if (!empty($counts[E_ERROR])) {
60
+			return sprintf('%d, %d!', $entryCount, $counts[E_ERROR]);
61
+		}
62
+		if ($entryCount > 0) {
63
+			return (string) $entryCount;
64
+		}
65
+		return '';
66
+	}
67 67
 
68
-    public function label(): string
69
-    {
70
-        return __('Console', 'blackbar');
71
-    }
68
+	public function label(): string
69
+	{
70
+		return __('Console', 'blackbar');
71
+	}
72 72
 
73
-    public function store(string $message, string $errno = '', string $location = ''): void
74
-    {
75
-        if (is_numeric($errno)) { // entry likely stored by set_error_handler()
76
-            $errname = 'Unknown';
77
-            if (array_key_exists((int) $errno, static::ERROR_CODES)) {
78
-                $errname = static::ERROR_CODES[$errno];
79
-            }
80
-        } else { // entry likely stored by filter hook
81
-            $errname = 'Debug';
82
-            if (array_key_exists($errno, static::MAPPED_ERROR_CODES)) {
83
-                $errname = $errno;
84
-                $errno = static::MAPPED_ERROR_CODES[$errno];
85
-            }
86
-        }
87
-        $errname = strtolower($errname);
88
-        $hash = md5($errno.$errname.$message.$location);
89
-        if (array_key_exists($hash, $this->entries)) {
90
-            ++$this->entries[$hash]['count'];
91
-        } else {
92
-            $this->entries[$hash] = [
93
-                'count' => 0,
94
-                'errname' => $errname,
95
-                'errno' => (int) $errno,
96
-                'message' => $this->normalizeMessage($message, $location),
97
-            ];
98
-        }
99
-    }
73
+	public function store(string $message, string $errno = '', string $location = ''): void
74
+	{
75
+		if (is_numeric($errno)) { // entry likely stored by set_error_handler()
76
+			$errname = 'Unknown';
77
+			if (array_key_exists((int) $errno, static::ERROR_CODES)) {
78
+				$errname = static::ERROR_CODES[$errno];
79
+			}
80
+		} else { // entry likely stored by filter hook
81
+			$errname = 'Debug';
82
+			if (array_key_exists($errno, static::MAPPED_ERROR_CODES)) {
83
+				$errname = $errno;
84
+				$errno = static::MAPPED_ERROR_CODES[$errno];
85
+			}
86
+		}
87
+		$errname = strtolower($errname);
88
+		$hash = md5($errno.$errname.$message.$location);
89
+		if (array_key_exists($hash, $this->entries)) {
90
+			++$this->entries[$hash]['count'];
91
+		} else {
92
+			$this->entries[$hash] = [
93
+				'count' => 0,
94
+				'errname' => $errname,
95
+				'errno' => (int) $errno,
96
+				'message' => $this->normalizeMessage($message, $location),
97
+			];
98
+		}
99
+	}
100 100
 
101
-    protected function normalizeMessage($message, string $location): string
102
-    {
103
-        if ($message instanceof \DateTime) {
104
-            $message = $message->format('Y-m-d H:i:s');
105
-        } elseif (is_object($message) || is_array($message)) {
106
-            $message = (new Dump())->dump($message);
107
-        } else {
108
-            $message = esc_html(trim((string) $message));
109
-        }
110
-        $location = trim($location);
111
-        if (!empty($location)) {
112
-            $location = str_replace([WP_CONTENT_DIR, ABSPATH], '', $location);
113
-            $location = sprintf('[%s]', $location);
114
-        }
115
-        return trim(sprintf('%s %s', $location, $message));
116
-    }
101
+	protected function normalizeMessage($message, string $location): string
102
+	{
103
+		if ($message instanceof \DateTime) {
104
+			$message = $message->format('Y-m-d H:i:s');
105
+		} elseif (is_object($message) || is_array($message)) {
106
+			$message = (new Dump())->dump($message);
107
+		} else {
108
+			$message = esc_html(trim((string) $message));
109
+		}
110
+		$location = trim($location);
111
+		if (!empty($location)) {
112
+			$location = str_replace([WP_CONTENT_DIR, ABSPATH], '', $location);
113
+			$location = sprintf('[%s]', $location);
114
+		}
115
+		return trim(sprintf('%s %s', $location, $message));
116
+	}
117 117
 }
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -29,37 +29,37 @@  discard block
 block discarded – undo
29 29
 
30 30
     public function classes(): string
31 31
     {
32
-        $errno = array_unique(wp_list_pluck($this->entries, 'errno'));
33
-        if (in_array(E_ERROR, $errno)) {
34
-            return sprintf('%s glbb-error', $this->id());
32
+        $errno = array_unique( wp_list_pluck( $this->entries, 'errno' ) );
33
+        if( in_array( E_ERROR, $errno ) ) {
34
+            return sprintf( '%s glbb-error', $this->id() );
35 35
         }
36
-        if (in_array(E_WARNING, $errno)) {
37
-            return sprintf('%s glbb-warning', $this->id());
36
+        if( in_array( E_WARNING, $errno ) ) {
37
+            return sprintf( '%s glbb-warning', $this->id() );
38 38
         }
39 39
         return $this->id();
40 40
     }
41 41
 
42 42
     public function entries(): array
43 43
     {
44
-        $entries = [];
45
-        foreach ($this->entries as $entry) {
46
-            $entry['name'] = ucfirst($entry['errname']);
47
-            if ($entry['count'] > 1) {
48
-                $entry['name'] = sprintf('%s (%s)', $entry['name'], $entry['count']);
44
+        $entries = [ ];
45
+        foreach( $this->entries as $entry ) {
46
+            $entry[ 'name' ] = ucfirst( $entry[ 'errname' ] );
47
+            if( $entry[ 'count' ] > 1 ) {
48
+                $entry[ 'name' ] = sprintf( '%s (%s)', $entry[ 'name' ], $entry[ 'count' ] );
49 49
             }
50
-            $entries[] = $entry;
50
+            $entries[ ] = $entry;
51 51
         }
52 52
         return $entries;
53 53
     }
54 54
 
55 55
     public function info(): string
56 56
     {
57
-        $counts = array_count_values(wp_list_pluck($this->entries, 'errno'));
58
-        $entryCount = count($this->entries);
59
-        if (!empty($counts[E_ERROR])) {
60
-            return sprintf('%d, %d!', $entryCount, $counts[E_ERROR]);
57
+        $counts = array_count_values( wp_list_pluck( $this->entries, 'errno' ) );
58
+        $entryCount = count( $this->entries );
59
+        if( !empty( $counts[ E_ERROR ] ) ) {
60
+            return sprintf( '%d, %d!', $entryCount, $counts[ E_ERROR ] );
61 61
         }
62
-        if ($entryCount > 0) {
62
+        if( $entryCount > 0 ) {
63 63
             return (string) $entryCount;
64 64
         }
65 65
         return '';
@@ -67,51 +67,51 @@  discard block
 block discarded – undo
67 67
 
68 68
     public function label(): string
69 69
     {
70
-        return __('Console', 'blackbar');
70
+        return __( 'Console', 'blackbar' );
71 71
     }
72 72
 
73
-    public function store(string $message, string $errno = '', string $location = ''): void
73
+    public function store( string $message, string $errno = '', string $location = '' ): void
74 74
     {
75
-        if (is_numeric($errno)) { // entry likely stored by set_error_handler()
75
+        if( is_numeric( $errno ) ) { // entry likely stored by set_error_handler()
76 76
             $errname = 'Unknown';
77
-            if (array_key_exists((int) $errno, static::ERROR_CODES)) {
78
-                $errname = static::ERROR_CODES[$errno];
77
+            if( array_key_exists( (int) $errno, static::ERROR_CODES ) ) {
78
+                $errname = static::ERROR_CODES[ $errno ];
79 79
             }
80 80
         } else { // entry likely stored by filter hook
81 81
             $errname = 'Debug';
82
-            if (array_key_exists($errno, static::MAPPED_ERROR_CODES)) {
82
+            if( array_key_exists( $errno, static::MAPPED_ERROR_CODES ) ) {
83 83
                 $errname = $errno;
84
-                $errno = static::MAPPED_ERROR_CODES[$errno];
84
+                $errno = static::MAPPED_ERROR_CODES[ $errno ];
85 85
             }
86 86
         }
87
-        $errname = strtolower($errname);
88
-        $hash = md5($errno.$errname.$message.$location);
89
-        if (array_key_exists($hash, $this->entries)) {
90
-            ++$this->entries[$hash]['count'];
87
+        $errname = strtolower( $errname );
88
+        $hash = md5( $errno . $errname . $message . $location );
89
+        if( array_key_exists( $hash, $this->entries ) ) {
90
+            ++$this->entries[ $hash ][ 'count' ];
91 91
         } else {
92
-            $this->entries[$hash] = [
92
+            $this->entries[ $hash ] = [
93 93
                 'count' => 0,
94 94
                 'errname' => $errname,
95 95
                 'errno' => (int) $errno,
96
-                'message' => $this->normalizeMessage($message, $location),
96
+                'message' => $this->normalizeMessage( $message, $location ),
97 97
             ];
98 98
         }
99 99
     }
100 100
 
101
-    protected function normalizeMessage($message, string $location): string
101
+    protected function normalizeMessage( $message, string $location ): string
102 102
     {
103
-        if ($message instanceof \DateTime) {
104
-            $message = $message->format('Y-m-d H:i:s');
105
-        } elseif (is_object($message) || is_array($message)) {
106
-            $message = (new Dump())->dump($message);
103
+        if( $message instanceof \DateTime ) {
104
+            $message = $message->format( 'Y-m-d H:i:s' );
105
+        } elseif( is_object( $message ) || is_array( $message ) ) {
106
+            $message = ( new Dump() )->dump( $message );
107 107
         } else {
108
-            $message = esc_html(trim((string) $message));
108
+            $message = esc_html( trim( (string) $message ) );
109 109
         }
110
-        $location = trim($location);
111
-        if (!empty($location)) {
112
-            $location = str_replace([WP_CONTENT_DIR, ABSPATH], '', $location);
113
-            $location = sprintf('[%s]', $location);
110
+        $location = trim( $location );
111
+        if( !empty( $location ) ) {
112
+            $location = str_replace( [ WP_CONTENT_DIR, ABSPATH ], '', $location );
113
+            $location = sprintf( '[%s]', $location );
114 114
         }
115
-        return trim(sprintf('%s %s', $location, $message));
115
+        return trim( sprintf( '%s %s', $location, $message ) );
116 116
     }
117 117
 }
Please login to merge, or discard this patch.
views/panels/hooks.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,9 +8,12 @@
 block discarded – undo
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>
Please login to merge, or discard this 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') || exit; ?>
1
+<?php defined( 'WPINC' ) || exit; ?>
2 2
 
3
-<?php if (!$module->hasEntries()) : ?>
3
+<?php if( !$module->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_hooks_callback" placeholder="<?= esc_attr__('Find callbacks containing', 'blackbar'); ?>">
14
-        <input type="text" id="glbb_hooks_min_time" placeholder="<?= esc_attr__('Minimum total time', 'blackbar'); ?>">
13
+        <input type="text" id="glbb_hooks_callback" placeholder="<?= esc_attr__( 'Find callbacks containing', 'blackbar' ); ?>">
14
+        <input type="text" id="glbb_hooks_min_time" placeholder="<?= esc_attr__( 'Minimum total time', 'blackbar' ); ?>">
15 15
         <select id="glbb_hooks_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 ($module->entries() as $hook => $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($hook); ?></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($data['per_call']); ?>"><?= esc_html($data['per_call']); ?></td>
37
-                    <td data-total="<?= esc_attr($data['total']); ?>"><?= esc_html($data['total_formatted']); ?></td>
31
+            <?php foreach( $module->entries() as $hook => $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( $hook ); ?></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( $data[ 'per_call' ] ); ?>"><?= esc_html( $data[ 'per_call' ] ); ?></td>
37
+                    <td data-total="<?= esc_attr( $data[ 'total' ] ); ?>"><?= esc_html( $data[ 'total_formatted' ] ); ?></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.