@@ -17,8 +17,8 @@ |
||
17 | 17 | <tbody> |
18 | 18 | <?php foreach( $queries as $query ) : ?> |
19 | 19 | <tr> |
20 | - <td class="glbb-small"><?= $query['ms']; ?></td> |
|
21 | - <td><pre><code class="sql"><?= $query['sql']; ?></code></pre></td> |
|
20 | + <td class="glbb-small"><?= $query[ 'ms' ]; ?></td> |
|
21 | + <td><pre><code class="sql"><?= $query[ 'sql' ]; ?></code></pre></td> |
|
22 | 22 | </tr> |
23 | 23 | <?php endforeach; ?> |
24 | 24 | </tbody> |
@@ -8,14 +8,14 @@ |
||
8 | 8 | spl_autoload_register( function( $class ) |
9 | 9 | { |
10 | 10 | $namespaces = [ |
11 | - 'GeminiLabs\\BlackBar\\' => __DIR__.'/src/', |
|
12 | - 'GeminiLabs\\BlackBar\\Tests\\' => __DIR__.'/tests/', |
|
11 | + 'GeminiLabs\\BlackBar\\' => __DIR__ . '/src/', |
|
12 | + 'GeminiLabs\\BlackBar\\Tests\\' => __DIR__ . '/tests/', |
|
13 | 13 | ]; |
14 | 14 | foreach( $namespaces as $prefix => $base_dir ) { |
15 | 15 | $len = strlen( $prefix ); |
16 | 16 | if( strncmp( $prefix, $class, $len ) !== 0 )continue; |
17 | - $file = $base_dir.str_replace( '\\', '/', substr( $class, $len )).'.php'; |
|
18 | - if( !file_exists( $file ))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 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public function getMemoryString( $timer ) |
41 | 41 | { |
42 | 42 | $timer = $this->normalize( $timer ); |
43 | - return sprintf( '%s kB', round( $timer['memory'] / 1000 )); |
|
43 | + return sprintf( '%s kB', round( $timer[ 'memory' ] / 1000 ) ); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public function getNameString( $timer ) |
51 | 51 | { |
52 | 52 | $timer = $this->normalize( $timer ); |
53 | - return $timer['name']; |
|
53 | + return $timer[ 'name' ]; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | public function getTimeString( $timer ) |
61 | 61 | { |
62 | 62 | $timer = $this->normalize( $timer ); |
63 | - $index = array_search( $timer['name'], array_column( $this->timers, 'name' )); |
|
63 | + $index = array_search( $timer[ 'name' ], array_column( $this->timers, 'name' ) ); |
|
64 | 64 | $start = $this->start + ( $index * $this->noise ); |
65 | - $time = number_format( round(( $timer['time'] - $start ) * 1000, 4 ), 4 ); |
|
65 | + $time = number_format( round( ( $timer[ 'time' ] - $start ) * 1000, 4 ), 4 ); |
|
66 | 66 | return sprintf( '%s ms', $time ); |
67 | 67 | } |
68 | 68 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $this->noise = $microtime - $this->start; |
90 | 90 | return; |
91 | 91 | } |
92 | - $this->timers[] = array( |
|
92 | + $this->timers[ ] = array( |
|
93 | 93 | 'memory' => memory_get_peak_usage(), |
94 | 94 | 'name' => $name, |
95 | 95 | 'time' => $microtime, |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | */ |
104 | 104 | protected function normalize( $timer ) |
105 | 105 | { |
106 | - return wp_parse_args( (array)$timer, array( |
|
106 | + return wp_parse_args( (array) $timer, array( |
|
107 | 107 | 'memory' => 0, |
108 | 108 | 'name' => '', |
109 | 109 | 'time' => 0, |
110 | - )); |
|
110 | + ) ); |
|
111 | 111 | } |
112 | 112 | } |
@@ -1,7 +1,7 @@ |
||
1 | 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( isset( $_SESSION ) ? $_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( isset( $_SESSION ) ? $_SESSION : [ ], true ) ); ?>;</code></pre><br/> |
|
7 | +<pre><code class="php">$_SERVER = <?= esc_html( var_export( $_SERVER, true ) ); ?>;</code></pre><br/> |
@@ -2,15 +2,15 @@ |
||
2 | 2 | |
3 | 3 | <table> |
4 | 4 | <tbody> |
5 | - <?php if( empty( $entries )) : ?> |
|
5 | + <?php if( empty( $entries ) ) : ?> |
|
6 | 6 | <tr> |
7 | 7 | <td><?= __( 'No entries found.', 'blackbar' ); ?></td> |
8 | 8 | </tr> |
9 | 9 | <?php else : ?> |
10 | 10 | <?php foreach( $entries as $entry ) : ?> |
11 | 11 | <tr> |
12 | - <td class="glbb-small"><?= $entry['name']; ?></td> |
|
13 | - <td><pre><?= $entry['message']; ?></pre></td> |
|
12 | + <td class="glbb-small"><?= $entry[ 'name' ]; ?></td> |
|
13 | + <td><pre><?= $entry[ 'message' ]; ?></pre></td> |
|
14 | 14 | </tr> |
15 | 15 | <?php endforeach; ?> |
16 | 16 | <?php endif; ?> |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | <table> |
4 | 4 | <tbody> |
5 | - <?php if( empty( $profiler->getMeasure() )) : ?> |
|
5 | + <?php if( empty( $profiler->getMeasure() ) ) : ?> |
|
6 | 6 | <tr> |
7 | 7 | <td><?= __( 'No entries found.', 'blackbar' ); ?></td> |
8 | 8 | </tr> |
@@ -7,7 +7,7 @@ discard block |
||
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'; |
|
10 | + $scripts[ ] = 'blackbar'; |
|
11 | 11 | return $scripts; |
12 | 12 | }); |
13 | 13 | |
@@ -16,7 +16,7 @@ discard block |
||
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'; |
|
19 | + $styles[ ] = 'blackbar'; |
|
20 | + $styles[ ] = 'blackbar-syntax'; |
|
21 | 21 | return $styles; |
22 | 22 | }); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $this->versions = wp_parse_args( $versions, array( |
31 | 31 | 'php' => static::MIN_PHP_VERSION, |
32 | 32 | 'wordpress' => static::MIN_WORDPRESS_VERSION, |
33 | - )); |
|
33 | + ) ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | if( $this->isValid() ) { |
42 | 42 | return true; |
43 | 43 | } |
44 | - add_action( 'activated_plugin', array( $this, 'deactivate' )); |
|
45 | - add_action( 'admin_notices', array( $this, 'deactivate' )); |
|
44 | + add_action( 'activated_plugin', array( $this, 'deactivate' ) ); |
|
45 | + add_action( 'admin_notices', array( $this, 'deactivate' ) ); |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function isPhpValid() |
53 | 53 | { |
54 | - return !version_compare( PHP_VERSION, $this->versions['php'], '<' ); |
|
54 | + return !version_compare( PHP_VERSION, $this->versions[ 'php' ], '<' ); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function isWpValid() |
69 | 69 | { |
70 | 70 | global $wp_version; |
71 | - return !version_compare( $wp_version, $this->versions['wordpress'], '<' ); |
|
71 | + return !version_compare( $wp_version, $this->versions[ 'wordpress' ], '<' ); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | $pluginData = get_file_data( $this->file, array( 'name' => 'Plugin Name' ), 'plugin' ); |
86 | 86 | deactivate_plugins( $pluginSlug ); |
87 | - $this->printNotice( $pluginData['name'] ); |
|
87 | + $this->printNotice( $pluginData[ 'name' ] ); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -111,19 +111,19 @@ discard block |
||
111 | 111 | { |
112 | 112 | $noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>'; |
113 | 113 | $messages = $this->getMessages(); |
114 | - $rollbackMessage = sprintf( '<strong>'.$messages[6].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/">WP Rollback</a>', $pluginName ); |
|
114 | + $rollbackMessage = sprintf( '<strong>' . $messages[ 6 ] . '</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/">WP Rollback</a>', $pluginName ); |
|
115 | 115 | if( !$this->isPhpValid() ) { |
116 | 116 | printf( $noticeTemplate, |
117 | - sprintf( $messages[0], $pluginName ), |
|
118 | - sprintf( $messages[1], $messages[3].' '.$this->versions['php'] ), |
|
119 | - sprintf( $messages[2], PHP_VERSION ).'</p><p>'.$rollbackMessage |
|
117 | + sprintf( $messages[ 0 ], $pluginName ), |
|
118 | + sprintf( $messages[ 1 ], $messages[ 3 ] . ' ' . $this->versions[ 'php' ] ), |
|
119 | + sprintf( $messages[ 2 ], PHP_VERSION ) . '</p><p>' . $rollbackMessage |
|
120 | 120 | ); |
121 | 121 | } |
122 | 122 | else if( !$this->isWpValid() ) { |
123 | 123 | printf( $noticeTemplate, |
124 | - sprintf( $messages[0], $pluginName ), |
|
125 | - sprintf( $messages[1], $messages[4].' '.$this->versions['wordpress'] ), |
|
126 | - $rollbackMessage.'</p><p>'.sprintf( '<a href="%s">%s</a>', admin_url( 'update-core.php' ), $messages[5] ) |
|
124 | + sprintf( $messages[ 0 ], $pluginName ), |
|
125 | + sprintf( $messages[ 1 ], $messages[ 4 ] . ' ' . $this->versions[ 'wordpress' ] ), |
|
126 | + $rollbackMessage . '</p><p>' . sprintf( '<a href="%s">%s</a>', admin_url( 'update-core.php' ), $messages[ 5 ] ) |
|
127 | 127 | ); |
128 | 128 | } |
129 | 129 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | filter_input( INPUT_GET, 'plugin_status' ), |
138 | 138 | filter_input( INPUT_GET, 'paged' ), |
139 | 139 | filter_input( INPUT_GET, 's' ) |
140 | - ))); |
|
140 | + ) ) ); |
|
141 | 141 | exit; |
142 | 142 | } |
143 | 143 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | public function __construct() |
22 | 22 | { |
23 | 23 | $this->console = new Console; |
24 | - $this->file = realpath( dirname( __DIR__ ).'/'.static::ID.'.php' ); |
|
24 | + $this->file = realpath( dirname( __DIR__ ) . '/' . static::ID . '.php' ); |
|
25 | 25 | $this->profiler = new Profiler; |
26 | 26 | } |
27 | 27 | |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | 8192 => 'Deprecated', //E_DEPRECATED |
42 | 42 | ); |
43 | 43 | $errname = array_key_exists( $errno, $errorCodes ) |
44 | - ? $errorCodes[$errno] |
|
44 | + ? $errorCodes[ $errno ] |
|
45 | 45 | : 'Unknown'; |
46 | - $hash = md5( $errno.$errstr.$errfile.$errline ); |
|
47 | - if( array_key_exists( $hash, $this->errors )) { |
|
48 | - $this->errors[$hash]['count']++; |
|
46 | + $hash = md5( $errno . $errstr . $errfile . $errline ); |
|
47 | + if( array_key_exists( $hash, $this->errors ) ) { |
|
48 | + $this->errors[ $hash ][ 'count' ]++; |
|
49 | 49 | } |
50 | 50 | else { |
51 | - $this->errors[$hash] = array( |
|
51 | + $this->errors[ $hash ] = array( |
|
52 | 52 | "errno" => $errno, |
53 | 53 | "message" => $errstr, |
54 | 54 | "file" => $errfile, |
@@ -65,17 +65,17 @@ discard block |
||
65 | 65 | public function init() |
66 | 66 | { |
67 | 67 | $controller = new Controller( $this ); |
68 | - add_action( 'admin_enqueue_scripts', array( $controller, 'enqueueAssets' )); |
|
69 | - add_action( 'wp_enqueue_scripts', array( $controller, 'enqueueAssets' )); |
|
70 | - add_action( 'plugins_loaded', array( $controller, 'registerLanguages' )); |
|
71 | - add_action( 'admin_footer', array( $controller, 'renderBar' )); |
|
72 | - add_action( 'wp_footer', array( $controller, 'renderBar' )); |
|
73 | - add_filter( 'admin_body_class', array( $controller, 'filterBodyClasses' )); |
|
74 | - add_filter( 'all', array( $controller, 'initConsole' )); |
|
75 | - add_filter( 'all', array( $controller, 'initProfiler' )); |
|
68 | + add_action( 'admin_enqueue_scripts', array( $controller, 'enqueueAssets' ) ); |
|
69 | + add_action( 'wp_enqueue_scripts', array( $controller, 'enqueueAssets' ) ); |
|
70 | + add_action( 'plugins_loaded', array( $controller, 'registerLanguages' ) ); |
|
71 | + add_action( 'admin_footer', array( $controller, 'renderBar' ) ); |
|
72 | + add_action( 'wp_footer', array( $controller, 'renderBar' ) ); |
|
73 | + add_filter( 'admin_body_class', array( $controller, 'filterBodyClasses' ) ); |
|
74 | + add_filter( 'all', array( $controller, 'initConsole' ) ); |
|
75 | + add_filter( 'all', array( $controller, 'initProfiler' ) ); |
|
76 | 76 | apply_filters( 'debug', 'Profiler Started' ); |
77 | 77 | apply_filters( 'debug', 'blackbar/profiler/noise' ); |
78 | - set_error_handler( array( $this, 'errorHandler' ), E_ALL|E_STRICT ); |
|
78 | + set_error_handler( array( $this, 'errorHandler' ), E_ALL | E_STRICT ); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function path( $file = '' ) |
86 | 86 | { |
87 | - return plugin_dir_path( $this->file ).ltrim( trim( $file ), '/' ); |
|
87 | + return plugin_dir_path( $this->file ) . ltrim( trim( $file ), '/' ); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function render( $view, array $data = array() ) |
95 | 95 | { |
96 | - $file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ))); |
|
97 | - if( !file_exists( $file ))return; |
|
96 | + $file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ) ) ); |
|
97 | + if( !file_exists( $file ) )return; |
|
98 | 98 | extract( $data ); |
99 | 99 | include $file; |
100 | 100 | } |
@@ -105,6 +105,6 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function url( $path = '' ) |
107 | 107 | { |
108 | - return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' )); |
|
108 | + return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ) ); |
|
109 | 109 | } |
110 | 110 | } |