Passed
Push — master ( acf75d...995929 )
by Paul
03:41
created
views/panels/templates.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,3 @@
 block discarded – undo
1
-<?php defined( 'WPINC' ) || die;
1
+<?php defined('WPINC') || die;
2 2
 
3 3
 Development::printTemplatePaths();
Please login to merge, or discard this patch.
views/panels/globals.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1
-<?php defined( 'WPINC' ) || die; ?>
1
+<?php defined('WPINC') || die; ?>
2 2
 
3
-<pre><code class="php">$_GET = <?= esc_html( var_export( $_GET, true )); ?>;</code></pre><br/>
4
-<pre><code class="php">$_POST = <?= esc_html( var_export( $_POST, true )); ?>;</code></pre><br/>
5
-<pre><code class="php">$_COOKIE = <?= esc_html( var_export( $_COOKIE, true )); ?>;</code></pre><br/>
6
-<pre><code class="php">$_SESSION = <?= esc_html( var_export( $_SESSION, true )); ?>;</code></pre><br/>
7
-<pre><code class="php">$_SERVER = <?= esc_html( var_export( $_SERVER, true )); ?>;</code></pre><br/>
3
+<pre><code class="php">$_GET = <?= esc_html(var_export($_GET, true)); ?>;</code></pre><br/>
4
+<pre><code class="php">$_POST = <?= esc_html(var_export($_POST, true)); ?>;</code></pre><br/>
5
+<pre><code class="php">$_COOKIE = <?= esc_html(var_export($_COOKIE, true)); ?>;</code></pre><br/>
6
+<pre><code class="php">$_SESSION = <?= esc_html(var_export($_SESSION, true)); ?>;</code></pre><br/>
7
+<pre><code class="php">$_SERVER = <?= esc_html(var_export($_SERVER, true)); ?>;</code></pre><br/>
Please login to merge, or discard this patch.
views/debug-bar.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;
2
-$isCastorTheme = class_exists( '\GeminiLabs\Castor\Application' );
1
+<?php defined('WPINC') || die;
2
+$isCastorTheme = class_exists('\GeminiLabs\Castor\Application');
3 3
 ?>
4 4
 
5 5
 <div id="glbb-debug-bar">
6
-	<a href="#" class="glbb-toggle glbb-off"><?= __( 'Toggle', 'blackbar' ); ?></a>
7
-	<a href="javascript:Blackbar.switchPanel('glbb-globals')" class="glbb-globals"><?= __( 'Globals', 'blackbar' ); ?></a>
6
+	<a href="#" class="glbb-toggle glbb-off"><?= __('Toggle', 'blackbar'); ?></a>
7
+	<a href="javascript:Blackbar.switchPanel('glbb-globals')" class="glbb-globals"><?= __('Globals', 'blackbar'); ?></a>
8 8
 	<a href="javascript:Blackbar.switchPanel('glbb-profiler')" class="glbb-profiler"><?= $profilerLabel; ?></a>
9 9
 	<a href="javascript:Blackbar.switchPanel('glbb-queries')" class="glbb-queries"><?= $queriesLabel; ?></a>
10
-	<?php if( $isCastorTheme ) : ?>
11
-	<a href="javascript:Blackbar.switchPanel('glbb-templates')" class="glbb-templates"><?= __( 'Templates', 'blackbar' ); ?></a>
10
+	<?php if ($isCastorTheme) : ?>
11
+	<a href="javascript:Blackbar.switchPanel('glbb-templates')" class="glbb-templates"><?= __('Templates', 'blackbar'); ?></a>
12 12
 	<?php endif; ?>
13 13
 	<a href="javascript:Blackbar.switchPanel('glbb-errors')" class="glbb-errors"><?= $errorsLabel; ?></a>
14
-	<a href="javascript:Blackbar.close()" class="glbb-close"><?= __( 'Close', 'blackbar' ); ?></a>
14
+	<a href="javascript:Blackbar.close()" class="glbb-close"><?= __('Close', 'blackbar'); ?></a>
15 15
 	<div id="glbb-globals" class="glbb-debug-panel">
16
-		<?php $blackbar->render( 'panels/globals' ); ?>
16
+		<?php $blackbar->render('panels/globals'); ?>
17 17
 	</div>
18 18
 	<div id="glbb-profiler" class="glbb-debug-panel">
19
-		<?php $blackbar->render( 'panels/profiler', array( 'profiler' => $profiler )); ?>
19
+		<?php $blackbar->render('panels/profiler', array('profiler' => $profiler)); ?>
20 20
 	</div>
21 21
 	<div id="glbb-queries" class="glbb-debug-panel">
22
-		<?php $blackbar->render( 'panels/queries', array( 'queries' => $queries )); ?>
22
+		<?php $blackbar->render('panels/queries', array('queries' => $queries)); ?>
23 23
 	</div>
24
-	<?php if( $isCastorTheme ) : ?>
24
+	<?php if ($isCastorTheme) : ?>
25 25
 	<div id="glbb-templates" class="glbb-debug-panel">
26
-		<?php $blackbar->render( 'panels/templates' ); ?>
26
+		<?php $blackbar->render('panels/templates'); ?>
27 27
 	</div>
28 28
 	<?php endif; ?>
29 29
 	<div id="glbb-errors" class="glbb-debug-panel">
30
-		<?php $blackbar->render( 'panels/errors', array( 'errors' => $errors )); ?>
30
+		<?php $blackbar->render('panels/errors', array('errors' => $errors)); ?>
31 31
 	</div>
32 32
 </div>
Please login to merge, or discard this patch.
autoload.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-defined( 'WPINC' ) || die;
3
+defined('WPINC') || die;
4 4
 
5 5
 /**
6 6
  * PSR-4 autoloader
7 7
  */
8
-spl_autoload_register( function( $class )
8
+spl_autoload_register(function($class)
9 9
 {
10 10
 	$namespaces = [
11 11
 		'GeminiLabs\\BlackBar\\' => __DIR__.'/src/',
12 12
 		'GeminiLabs\\BlackBar\\Tests\\' => __DIR__.'/tests/',
13 13
 	];
14
-	foreach( $namespaces as $prefix => $base_dir ) {
15
-		$len = strlen( $prefix );
16
-		if( strncmp( $prefix, $class, $len ) !== 0 )continue;
17
-		$file = $base_dir . str_replace( '\\', '/', substr( $class, $len )).'.php';
18
-		if( !file_exists( $file ))continue;
14
+	foreach ($namespaces as $prefix => $base_dir) {
15
+		$len = strlen($prefix);
16
+		if (strncmp($prefix, $class, $len) !== 0)continue;
17
+		$file = $base_dir.str_replace('\\', '/', substr($class, $len)).'.php';
18
+		if (!file_exists($file))continue;
19 19
 		require $file;
20 20
 		break;
21 21
 	}
Please login to merge, or discard this patch.
src/Profiler.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -37,19 +37,19 @@  discard block
 block discarded – undo
37 37
 	 * @param array $timer
38 38
 	 * @return string
39 39
 	 */
40
-	public function getMemoryString( $timer )
40
+	public function getMemoryString($timer)
41 41
 	{
42
-		$timer = $this->normalize( $timer );
43
-		return sprintf( '%s kB', round( $timer['memory'] / 1000 ));
42
+		$timer = $this->normalize($timer);
43
+		return sprintf('%s kB', round($timer['memory'] / 1000));
44 44
 	}
45 45
 
46 46
 	/**
47 47
 	 * @param array $timer
48 48
 	 * @return string
49 49
 	 */
50
-	public function getNameString( $timer )
50
+	public function getNameString($timer)
51 51
 	{
52
-		$timer = $this->normalize( $timer );
52
+		$timer = $this->normalize($timer);
53 53
 		return $timer['name'];
54 54
 	}
55 55
 
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 	 * @param array $timer
58 58
 	 * @return string
59 59
 	 */
60
-	public function getTimeString( $timer )
60
+	public function getTimeString($timer)
61 61
 	{
62
-		$timer = $this->normalize( $timer );
63
-		$index = array_search( $timer['name'], array_column( $this->timers, 'name' ));
64
-		$start = $this->start + ( $index * $this->noise );
65
-		$time = number_format( round(( $timer['time'] - $start ) * 1000, 4 ), 4 );
66
-		return sprintf( '%s ms', $time );
62
+		$timer = $this->normalize($timer);
63
+		$index = array_search($timer['name'], array_column($this->timers, 'name'));
64
+		$start = $this->start + ($index * $this->noise);
65
+		$time = number_format(round(($timer['time'] - $start) * 1000, 4), 4);
66
+		return sprintf('%s ms', $time);
67 67
 	}
68 68
 
69 69
 	/**
@@ -71,20 +71,20 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public function getTotalTime()
73 73
 	{
74
-		$totalNoise = ( count( $this->timers ) - 1 ) * $this->noise;
74
+		$totalNoise = (count($this->timers) - 1) * $this->noise;
75 75
 		return $this->stop - $this->start - $totalNoise;
76 76
 	}
77 77
 
78 78
 	/**
79 79
 	 * @param string $name
80 80
 	 */
81
-	public function trace( $name )
81
+	public function trace($name)
82 82
 	{
83
-		$microtime = microtime( true );
84
-		if( !$this->start ) {
83
+		$microtime = microtime(true);
84
+		if (!$this->start) {
85 85
 			$this->start = $microtime;
86 86
 		}
87
-		if( $name === 'blackbar/profiler/noise' ) {
87
+		if ($name === 'blackbar/profiler/noise') {
88 88
 			$this->noise = $microtime - $this->start;
89 89
 			return;
90 90
 		}
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	/**
100 100
 	 * @return array
101 101
 	 */
102
-	protected function normalize( $timer )
102
+	protected function normalize($timer)
103 103
 	{
104
-		return wp_parse_args( (array) $timer, array(
104
+		return wp_parse_args((array) $timer, array(
105 105
 			'name' => '',
106 106
 			'time' => 0,
107 107
 			'memory' => 0,
Please login to merge, or discard this patch.
activate.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-defined( 'WPINC' ) || die;
3
+defined('WPINC') || die;
4 4
 
5 5
 /**
6 6
  * Checks for minimum system requirments on plugin activation
@@ -30,21 +30,21 @@  discard block
 block discarded – undo
30 30
 	 * @param string $version
31 31
 	 * @return bool
32 32
 	 */
33
-	public static function isPhpValid( $version = '' )
33
+	public static function isPhpValid($version = '')
34 34
 	{
35
-		if( !empty( $version )) {
36
-			static::normalize( array( 'php' => $version ));
35
+		if (!empty($version)) {
36
+			static::normalize(array('php' => $version));
37 37
 		}
38
-		return !version_compare( PHP_VERSION, static::$versions->php, '<' );
38
+		return !version_compare(PHP_VERSION, static::$versions->php, '<');
39 39
 	}
40 40
 
41 41
 	/**
42 42
 	 * @return bool
43 43
 	 */
44
-	public static function isValid( array $args = array() )
44
+	public static function isValid(array $args = array())
45 45
 	{
46
-		if( !empty( $args )) {
47
-			static::normalize( $args );
46
+		if (!empty($args)) {
47
+			static::normalize($args);
48 48
 		}
49 49
 		return static::isPhpValid() && static::isWpValid();
50 50
 	}
@@ -53,28 +53,28 @@  discard block
 block discarded – undo
53 53
 	 * @param string $version
54 54
 	 * @return bool
55 55
 	 */
56
-	public static function isWpValid( $version = '' )
56
+	public static function isWpValid($version = '')
57 57
 	{
58 58
 		global $wp_version;
59
-		if( !empty( $version )) {
60
-			static::normalize( array( 'wordpress' => $version ));
59
+		if (!empty($version)) {
60
+			static::normalize(array('wordpress' => $version));
61 61
 		}
62
-		return !version_compare( $wp_version, static::$versions->wordpress, '<' );
62
+		return !version_compare($wp_version, static::$versions->wordpress, '<');
63 63
 	}
64 64
 
65 65
 	/**
66 66
 	 * @return bool
67 67
 	 */
68
-	public static function shouldDeactivate( $file, array $args = array() )
68
+	public static function shouldDeactivate($file, array $args = array())
69 69
 	{
70
-		if( empty( static::$instance )) {
71
-			static::$file = realpath( $file );
70
+		if (empty(static::$instance)) {
71
+			static::$file = realpath($file);
72 72
 			static::$instance = new static;
73
-			static::$versions = static::normalize( $args );
73
+			static::$versions = static::normalize($args);
74 74
 		}
75
-		if( !static::isValid() ) {
76
-			add_action( 'activated_plugin', array( static::$instance, 'deactivate' ));
77
-			add_action( 'admin_notices', array( static::$instance, 'deactivate' ));
75
+		if (!static::isValid()) {
76
+			add_action('activated_plugin', array(static::$instance, 'deactivate'));
77
+			add_action('admin_notices', array(static::$instance, 'deactivate'));
78 78
 			return true;
79 79
 		}
80 80
 		return false;
@@ -83,24 +83,24 @@  discard block
 block discarded – undo
83 83
 	/**
84 84
 	 * @return void
85 85
 	 */
86
-	public function deactivate( $plugin )
86
+	public function deactivate($plugin)
87 87
 	{
88
-		if( static::isValid() )return;
89
-		$pluginSlug = plugin_basename( static::$file );
90
-		if( $plugin == $pluginSlug ) {
88
+		if (static::isValid())return;
89
+		$pluginSlug = plugin_basename(static::$file);
90
+		if ($plugin == $pluginSlug) {
91 91
 			$this->redirect(); //exit
92 92
 		}
93
-		$pluginData = get_file_data( static::$file, array( 'name' => 'Plugin Name' ), 'plugin' );
94
-		deactivate_plugins( $pluginSlug );
95
-		$this->printNotice( $pluginData['name'] );
93
+		$pluginData = get_file_data(static::$file, array('name' => 'Plugin Name'), 'plugin');
94
+		deactivate_plugins($pluginSlug);
95
+		$this->printNotice($pluginData['name']);
96 96
 	}
97 97
 
98 98
 	/**
99 99
 	 * @return object
100 100
 	 */
101
-	protected static function normalize( array $args = array() )
101
+	protected static function normalize(array $args = array())
102 102
 	{
103
-		return (object)wp_parse_args( $args, array(
103
+		return (object) wp_parse_args($args, array(
104 104
 			'php' => static::MIN_PHP_VERSION,
105 105
 			'wordpress' => static::MIN_WORDPRESS_VERSION,
106 106
 		));
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	protected function redirect()
113 113
 	{
114
-		wp_safe_redirect( self_admin_url( sprintf( 'plugins.php?plugin_status=%s&paged=%s&s=%s',
115
-			filter_input( INPUT_GET, 'plugin_status' ),
116
-			filter_input( INPUT_GET, 'paged' ),
117
-			filter_input( INPUT_GET, 's' )
114
+		wp_safe_redirect(self_admin_url(sprintf('plugins.php?plugin_status=%s&paged=%s&s=%s',
115
+			filter_input(INPUT_GET, 'plugin_status'),
116
+			filter_input(INPUT_GET, 'paged'),
117
+			filter_input(INPUT_GET, 's')
118 118
 		)));
119 119
 		exit;
120 120
 	}
@@ -123,29 +123,29 @@  discard block
 block discarded – undo
123 123
 	 * @param string $pluginName
124 124
 	 * @return void
125 125
 	 */
126
-	protected function printNotice( $pluginName )
126
+	protected function printNotice($pluginName)
127 127
 	{
128 128
 		$noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>';
129 129
 		$messages = array(
130
-			__( 'The %s plugin was deactivated.', 'blackbar' ),
131
-			__( 'Sorry, this plugin requires %s or greater in order to work properly.', 'blackbar' ),
132
-			__( '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.', 'blackbar' ),
133
-			__( 'PHP version', 'blackbar' ),
134
-			__( 'WordPress version', 'blackbar' ),
135
-			__( 'Update WordPress', 'blackbar' ),
130
+			__('The %s plugin was deactivated.', 'blackbar'),
131
+			__('Sorry, this plugin requires %s or greater in order to work properly.', 'blackbar'),
132
+			__('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.', 'blackbar'),
133
+			__('PHP version', 'blackbar'),
134
+			__('WordPress version', 'blackbar'),
135
+			__('Update WordPress', 'blackbar'),
136 136
 		);
137
-		if( !static::isPhpValid() ) {
138
-			printf( $noticeTemplate,
139
-				sprintf( $messages[0], $pluginName ),
140
-				sprintf( $messages[1], $messages[3].' '.static::$versions->php ),
141
-				sprintf( $messages[2], PHP_VERSION )
137
+		if (!static::isPhpValid()) {
138
+			printf($noticeTemplate,
139
+				sprintf($messages[0], $pluginName),
140
+				sprintf($messages[1], $messages[3].' '.static::$versions->php),
141
+				sprintf($messages[2], PHP_VERSION)
142 142
 			);
143 143
 		}
144
-		else if( !static::isWpValid() ) {
145
-			printf( $noticeTemplate,
146
-				sprintf( $messages[0], $pluginName ),
147
-				sprintf( $messages[1], $messages[4].' '.static::$versions->wordpress ),
148
-				sprintf( '<a href="%s">%s</a>', admin_url( 'update-core.php' ), $messages[5] )
144
+		else if (!static::isWpValid()) {
145
+			printf($noticeTemplate,
146
+				sprintf($messages[0], $pluginName),
147
+				sprintf($messages[1], $messages[4].' '.static::$versions->wordpress),
148
+				sprintf('<a href="%s">%s</a>', admin_url('update-core.php'), $messages[5])
149 149
 			);
150 150
 		}
151 151
 	}
Please login to merge, or discard this patch.
views/panels/queries.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1
-<?php defined( 'WPINC' ) || die; ?>
1
+<?php defined('WPINC') || die; ?>
2 2
 
3
-<?php if( !SAVEQUERIES ) : ?>
3
+<?php if (!SAVEQUERIES) : ?>
4 4
 <table>
5 5
 	<tbody>
6 6
 		<tr>
7
-			<td><a href="https://codex.wordpress.org/Debugging_in_WordPress#SAVEQUERIES">SAVEQUERIES</a> <?= __( 'must be enabled to view SQL queries', 'blackbar' ); ?>.</td>
7
+			<td><a href="https://codex.wordpress.org/Debugging_in_WordPress#SAVEQUERIES">SAVEQUERIES</a> <?= __('must be enabled to view SQL queries', 'blackbar'); ?>.</td>
8 8
 		</tr>
9 9
 	</tbody>
10 10
 </table>
11 11
 <?php else : ?>
12 12
 <form method="get" class="glbb-queries-filter">
13
-	<input type="text" name="glbb_query_filter" id="glbb_query_filter" placeholder="<?= __( 'Find queries containing', 'blackbar' ); ?>">
14
-	<input type="text" name="glbb_query_min_time" id="glbb_query_min_time" placeholder="<?= __( 'Minimum Execution Time', 'blackbar' ); ?>">
13
+	<input type="text" name="glbb_query_filter" id="glbb_query_filter" placeholder="<?= __('Find queries containing', 'blackbar'); ?>">
14
+	<input type="text" name="glbb_query_min_time" id="glbb_query_min_time" placeholder="<?= __('Minimum Execution Time', 'blackbar'); ?>">
15 15
 </form>
16 16
 <table class="glbb-queries-table">
17 17
 	<tbody>
18
-		<?php foreach( $queries as $query ) : ?>
18
+		<?php foreach ($queries as $query) : ?>
19 19
 		<tr>
20 20
 			<td class="glbb-small"><?= $query['ms']; ?></td>
21 21
 			<td><pre><code class="sql"><?= $query['sql']; ?></code></pre></td>
Please login to merge, or discard this patch.
views/panels/errors.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 3
 <table>
4 4
 	<tbody>
5
-		<?php if( empty( $errors )) : ?>
5
+		<?php if (empty($errors)) : ?>
6 6
 		<tr>
7
-			<td><?= __( 'No errors found.', 'blackbar' ); ?></td>
7
+			<td><?= __('No errors found.', 'blackbar'); ?></td>
8 8
 		</tr>
9 9
 		<?php else : ?>
10
-		<?php foreach( $errors as $error ) : ?>
10
+		<?php foreach ($errors as $error) : ?>
11 11
 		<tr>
12 12
 			<td class="glbb-small"><?= $error['name']; ?></td>
13 13
 			<td><?= $error['message']; ?></td>
Please login to merge, or discard this patch.
views/panels/profiler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1
-<?php defined( 'WPINC' ) || die; ?>
1
+<?php defined('WPINC') || die; ?>
2 2
 
3 3
 <table>
4 4
 	<tbody>
5
-	<?php foreach( $profiler->getMeasure() as $timer ) : ?>
5
+	<?php foreach ($profiler->getMeasure() as $timer) : ?>
6 6
 		<tr>
7
-			<td><?= $profiler->getNameString( $timer ); ?></td>
8
-			<td class="glbb-medium"><?= $profiler->getTimeString( $timer ); ?></td>
9
-			<td class="glbb-medium"><?= $profiler->getMemoryString( $timer ); ?></td>
7
+			<td><?= $profiler->getNameString($timer); ?></td>
8
+			<td class="glbb-medium"><?= $profiler->getTimeString($timer); ?></td>
9
+			<td class="glbb-medium"><?= $profiler->getMemoryString($timer); ?></td>
10 10
 		</tr>
11 11
 	<?php endforeach; ?>
12 12
 	</tbody>
Please login to merge, or discard this patch.