@@ -13,9 +13,13 @@ |
||
13 | 13 | ]; |
14 | 14 | foreach( $namespaces as $prefix => $base_dir ) { |
15 | 15 | $len = strlen( $prefix ); |
16 | - if( strncmp( $prefix, $class, $len ) !== 0 )continue; |
|
16 | + if( strncmp( $prefix, $class, $len ) !== 0 ) { |
|
17 | + continue; |
|
18 | + } |
|
17 | 19 | $file = $base_dir . str_replace( '\\', '/', substr( $class, $len )).'.php'; |
18 | - if( !file_exists( $file ))continue; |
|
20 | + if( !file_exists( $file )) { |
|
21 | + continue; |
|
22 | + } |
|
19 | 23 | require $file; |
20 | 24 | break; |
21 | 25 | } |
@@ -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 | } |
@@ -8,9 +8,12 @@ |
||
8 | 8 | </tr> |
9 | 9 | </tbody> |
10 | 10 | </table> |
11 | -<?php else : ?> |
|
11 | +<?php else { |
|
12 | + : ?> |
|
12 | 13 | <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_filter" id="glbb_query_filter" placeholder="<?= __( 'Find queries containing', 'blackbar' ); |
|
15 | +} |
|
16 | +?>"> |
|
14 | 17 | <input type="text" name="glbb_query_min_time" id="glbb_query_min_time" placeholder="<?= __( 'Minimum Execution Time', 'blackbar' ); ?>"> |
15 | 18 | </form> |
16 | 19 | <table class="glbb-queries-table"> |
@@ -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> |
@@ -6,10 +6,13 @@ |
||
6 | 6 | <tr> |
7 | 7 | <td><?= __( 'No errors found.', 'blackbar' ); ?></td> |
8 | 8 | </tr> |
9 | - <?php else : ?> |
|
9 | + <?php else { |
|
10 | + : ?> |
|
10 | 11 | <?php foreach( $errors as $error ) : ?> |
11 | 12 | <tr> |
12 | - <td class="glbb-small"><?= $error['name']; ?></td> |
|
13 | + <td class="glbb-small"><?= $error['name']; |
|
14 | +} |
|
15 | +?></td> |
|
13 | 16 | <td><?= $error['message']; ?></td> |
14 | 17 | </tr> |
15 | 18 | <?php endforeach; ?> |
@@ -2,15 +2,15 @@ |
||
2 | 2 | |
3 | 3 | <table> |
4 | 4 | <tbody> |
5 | - <?php if( empty( $errors )) : ?> |
|
5 | + <?php if( empty( $errors ) ) : ?> |
|
6 | 6 | <tr> |
7 | 7 | <td><?= __( 'No errors found.', 'blackbar' ); ?></td> |
8 | 8 | </tr> |
9 | 9 | <?php else : ?> |
10 | 10 | <?php foreach( $errors as $error ) : ?> |
11 | 11 | <tr> |
12 | - <td class="glbb-small"><?= $error['name']; ?></td> |
|
13 | - <td><?= $error['message']; ?></td> |
|
12 | + <td class="glbb-small"><?= $error[ 'name' ]; ?></td> |
|
13 | + <td><?= $error[ 'message' ]; ?></td> |
|
14 | 14 | </tr> |
15 | 15 | <?php endforeach; ?> |
16 | 16 | <?php endif; ?> |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | */ |
33 | 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 | 38 | return !version_compare( PHP_VERSION, static::$versions->php, '<' ); |
39 | 39 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public static function isValid( array $args = array() ) |
45 | 45 | { |
46 | - if( !empty( $args )) { |
|
46 | + if( !empty( $args ) ) { |
|
47 | 47 | static::normalize( $args ); |
48 | 48 | } |
49 | 49 | return static::isPhpValid() && static::isWpValid(); |
@@ -56,8 +56,8 @@ discard block |
||
56 | 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 | 62 | return !version_compare( $wp_version, static::$versions->wordpress, '<' ); |
63 | 63 | } |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public static function shouldDeactivate( $file, array $args = array() ) |
69 | 69 | { |
70 | - if( empty( static::$instance )) { |
|
70 | + if( empty( static::$instance ) ) { |
|
71 | 71 | static::$file = realpath( $file ); |
72 | 72 | static::$instance = new static; |
73 | 73 | static::$versions = static::normalize( $args ); |
74 | 74 | } |
75 | 75 | if( !static::isValid() ) { |
76 | - add_action( 'activated_plugin', array( static::$instance, 'deactivate' )); |
|
77 | - add_action( 'admin_notices', array( static::$instance, 'deactivate' )); |
|
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; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | $pluginData = get_file_data( static::$file, array( 'name' => 'Plugin Name' ), 'plugin' ); |
94 | 94 | deactivate_plugins( $pluginSlug ); |
95 | - $this->printNotice( $pluginData['name'] ); |
|
95 | + $this->printNotice( $pluginData[ 'name' ] ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | */ |
101 | 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 | + ) ); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | filter_input( INPUT_GET, 'plugin_status' ), |
116 | 116 | filter_input( INPUT_GET, 'paged' ), |
117 | 117 | filter_input( INPUT_GET, 's' ) |
118 | - ))); |
|
118 | + ) ) ); |
|
119 | 119 | exit; |
120 | 120 | } |
121 | 121 | |
@@ -136,16 +136,16 @@ discard block |
||
136 | 136 | ); |
137 | 137 | if( !static::isPhpValid() ) { |
138 | 138 | printf( $noticeTemplate, |
139 | - sprintf( $messages[0], $pluginName ), |
|
140 | - sprintf( $messages[1], $messages[3].' '.static::$versions->php ), |
|
141 | - sprintf( $messages[2], PHP_VERSION ) |
|
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 | 144 | else if( !static::isWpValid() ) { |
145 | 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] ) |
|
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 | } |
@@ -85,7 +85,9 @@ |
||
85 | 85 | */ |
86 | 86 | public function deactivate( $plugin ) |
87 | 87 | { |
88 | - if( static::isValid() )return; |
|
88 | + if( static::isValid() ) { |
|
89 | + return; |
|
90 | + } |
|
89 | 91 | $pluginSlug = plugin_basename( static::$file ); |
90 | 92 | if( $plugin == $pluginSlug ) { |
91 | 93 | $this->redirect(); //exit |
@@ -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( $_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/> |
@@ -18,14 +18,14 @@ |
||
18 | 18 | |
19 | 19 | defined( 'WPINC' ) || die; |
20 | 20 | |
21 | -if( !class_exists( 'GL_Plugin_Check' )) { |
|
22 | - require_once __DIR__.'/activate.php'; |
|
21 | +if( !class_exists( 'GL_Plugin_Check' ) ) { |
|
22 | + require_once __DIR__ . '/activate.php'; |
|
23 | 23 | } |
24 | -require_once __DIR__.'/autoload.php'; |
|
24 | +require_once __DIR__ . '/autoload.php'; |
|
25 | 25 | |
26 | -if( !GL_Plugin_Check::shouldDeactivate( __FILE__, array( 'php' => '5.4', 'wordpress' => '4.0.0' ))) { |
|
27 | - if( !defined( 'SAVEQUERIES' )) { |
|
26 | +if( !GL_Plugin_Check::shouldDeactivate( __FILE__, array( 'php' => '5.4', 'wordpress' => '4.0.0' ) ) ) { |
|
27 | + if( !defined( 'SAVEQUERIES' ) ) { |
|
28 | 28 | define( 'SAVEQUERIES', 1 ); |
29 | 29 | } |
30 | - (new GeminiLabs\BlackBar\Application)->init(); |
|
30 | + ( new GeminiLabs\BlackBar\Application )->init(); |
|
31 | 31 | } |
@@ -14,17 +14,17 @@ |
||
14 | 14 | <?php $blackbar->render( 'panels/globals' ); ?> |
15 | 15 | </div> |
16 | 16 | <div id="glbb-profiler" class="glbb-debug-panel"> |
17 | - <?php $blackbar->render( 'panels/profiler', array( 'profiler' => $profiler )); ?> |
|
17 | + <?php $blackbar->render( 'panels/profiler', array( 'profiler' => $profiler ) ); ?> |
|
18 | 18 | </div> |
19 | 19 | <div id="glbb-queries" class="glbb-debug-panel"> |
20 | - <?php $blackbar->render( 'panels/queries', array( 'queries' => $queries )); ?> |
|
20 | + <?php $blackbar->render( 'panels/queries', array( 'queries' => $queries ) ); ?> |
|
21 | 21 | </div> |
22 | 22 | <?php if( !is_admin() ) : ?> |
23 | 23 | <div id="glbb-templates" class="glbb-debug-panel"> |
24 | - <?php $blackbar->render( 'panels/templates', array( 'templates' => $templates )); ?> |
|
24 | + <?php $blackbar->render( 'panels/templates', array( 'templates' => $templates ) ); ?> |
|
25 | 25 | </div> |
26 | 26 | <?php endif; ?> |
27 | 27 | <div id="glbb-errors" class="glbb-debug-panel"> |
28 | - <?php $blackbar->render( 'panels/errors', array( 'errors' => $errors )); ?> |
|
28 | + <?php $blackbar->render( 'panels/errors', array( 'errors' => $errors ) ); ?> |
|
29 | 29 | </div> |
30 | 30 | </div> |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | public function __construct() |
19 | 19 | { |
20 | - $this->file = realpath( dirname( __DIR__ ).'/'.static::ID.'.php' ); |
|
20 | + $this->file = realpath( dirname( __DIR__ ) . '/' . static::ID . '.php' ); |
|
21 | 21 | $this->profiler = new Profiler; |
22 | 22 | } |
23 | 23 | |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | 8192 => 'Deprecated', |
38 | 38 | ); |
39 | 39 | $errname = array_key_exists( $errno, $errorCodes ) |
40 | - ? $errorCodes[$errno] |
|
40 | + ? $errorCodes[ $errno ] |
|
41 | 41 | : 'Unknown'; |
42 | - $hash = md5( $errno.$errstr.$errfile.$errline ); |
|
43 | - if( array_key_exists( $hash, $this->errors )) { |
|
44 | - $this->errors[$hash]['count']++; |
|
42 | + $hash = md5( $errno . $errstr . $errfile . $errline ); |
|
43 | + if( array_key_exists( $hash, $this->errors ) ) { |
|
44 | + $this->errors[ $hash ][ 'count' ]++; |
|
45 | 45 | } |
46 | 46 | else { |
47 | - $this->errors[$hash] = array( |
|
47 | + $this->errors[ $hash ] = array( |
|
48 | 48 | "errno" => $errno, |
49 | 49 | "message" => $errstr, |
50 | 50 | "file" => $errfile, |
@@ -61,18 +61,18 @@ discard block |
||
61 | 61 | public function init() |
62 | 62 | { |
63 | 63 | $controller = new Controller( $this ); |
64 | - add_action( 'admin_enqueue_scripts', array( $controller, 'enqueueAssets' )); |
|
65 | - add_action( 'wp_enqueue_scripts', array( $controller, 'enqueueAssets' )); |
|
66 | - add_action( 'plugins_loaded', array( $controller, 'registerLanguages' )); |
|
67 | - add_action( 'admin_footer', array( $controller, 'renderBar' )); |
|
68 | - add_action( 'wp_footer', array( $controller, 'renderBar' )); |
|
69 | - add_filter( 'admin_body_class', array( $controller, 'filterBodyClasses' )); |
|
70 | - add_filter( 'gform_noconflict_scripts', array( $controller, 'filterNoconflictScripts' )); |
|
71 | - add_filter( 'gform_noconflict_styles', array( $controller, 'filterNoconflictStyles' )); |
|
72 | - add_filter( 'all', array( $controller, 'initProfiler' )); |
|
64 | + add_action( 'admin_enqueue_scripts', array( $controller, 'enqueueAssets' ) ); |
|
65 | + add_action( 'wp_enqueue_scripts', array( $controller, 'enqueueAssets' ) ); |
|
66 | + add_action( 'plugins_loaded', array( $controller, 'registerLanguages' ) ); |
|
67 | + add_action( 'admin_footer', array( $controller, 'renderBar' ) ); |
|
68 | + add_action( 'wp_footer', array( $controller, 'renderBar' ) ); |
|
69 | + add_filter( 'admin_body_class', array( $controller, 'filterBodyClasses' ) ); |
|
70 | + add_filter( 'gform_noconflict_scripts', array( $controller, 'filterNoconflictScripts' ) ); |
|
71 | + add_filter( 'gform_noconflict_styles', array( $controller, 'filterNoconflictStyles' ) ); |
|
72 | + add_filter( 'all', array( $controller, 'initProfiler' ) ); |
|
73 | 73 | apply_filters( 'debug', 'Profiler Started' ); |
74 | 74 | apply_filters( 'debug', 'blackbar/profiler/noise' ); |
75 | - set_error_handler( array( $this, 'errorHandler' ), E_ALL|E_STRICT ); |
|
75 | + set_error_handler( array( $this, 'errorHandler' ), E_ALL | E_STRICT ); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function path( $file = '' ) |
83 | 83 | { |
84 | - return plugin_dir_path( $this->file ).ltrim( trim( $file ), '/' ); |
|
84 | + return plugin_dir_path( $this->file ) . ltrim( trim( $file ), '/' ); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function render( $view, array $data = array() ) |
92 | 92 | { |
93 | - $file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ))); |
|
94 | - if( !file_exists( $file ))return; |
|
93 | + $file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ) ) ); |
|
94 | + if( !file_exists( $file ) )return; |
|
95 | 95 | extract( $data ); |
96 | 96 | include $file; |
97 | 97 | } |
@@ -102,6 +102,6 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function url( $path = '' ) |
104 | 104 | { |
105 | - return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' )); |
|
105 | + return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ) ); |
|
106 | 106 | } |
107 | 107 | } |
@@ -91,7 +91,9 @@ |
||
91 | 91 | public function render( $view, array $data = array() ) |
92 | 92 | { |
93 | 93 | $file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ))); |
94 | - if( !file_exists( $file ))return; |
|
94 | + if( !file_exists( $file )) { |
|
95 | + return; |
|
96 | + } |
|
95 | 97 | extract( $data ); |
96 | 98 | include $file; |
97 | 99 | } |
@@ -65,7 +65,9 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function initProfiler() |
67 | 67 | { |
68 | - if( func_get_arg(0) != Application::DEBUG )return; |
|
68 | + if( func_get_arg(0) != Application::DEBUG ) { |
|
69 | + return; |
|
70 | + } |
|
69 | 71 | $this->app->profiler->trace( func_get_arg(1) ); |
70 | 72 | } |
71 | 73 | |
@@ -154,12 +156,14 @@ discard block |
||
154 | 156 | */ |
155 | 157 | protected function getIncludedFiles() |
156 | 158 | { |
157 | - $files = array_values( array_filter( get_included_files(), function( $file ) { |
|
159 | + $files = array_values( array_filter( get_included_files(), function( $file ) |
|
160 | + { |
|
158 | 161 | $bool = strpos( $file, '/themes/' ) !== false |
159 | 162 | && strpos( $file, '/functions.php' ) === false; |
160 | 163 | return (bool)apply_filters( 'blackbar/templates/file', $bool, $file ); |
161 | 164 | })); |
162 | - return array_map( function( $key, $value ) { |
|
165 | + return array_map( function( $key, $value ) |
|
166 | + { |
|
163 | 167 | $value = str_replace( trailingslashit( WP_CONTENT_DIR ), '', $value ); |
164 | 168 | return sprintf( '[%s] => %s', $key, $value ); |
165 | 169 | }, array_keys( $files ), $files ); |
@@ -185,7 +189,8 @@ discard block |
||
185 | 189 | 'AND', 'FROM', 'GROUP BY', 'INNER JOIN', 'LIMIT', 'ON DUPLICATE KEY UPDATE', |
186 | 190 | 'ORDER BY', 'SET', 'WHERE', |
187 | 191 | ); |
188 | - $replace = array_map( function( $value ) { |
|
192 | + $replace = array_map( function( $value ) |
|
193 | + { |
|
189 | 194 | return PHP_EOL.$value; |
190 | 195 | }, $search ); |
191 | 196 | foreach( $wpdb->queries as $query ) { |
@@ -224,7 +229,9 @@ discard block |
||
224 | 229 | */ |
225 | 230 | protected function getTemplates() |
226 | 231 | { |
227 | - if( is_admin() )return; |
|
232 | + if( is_admin() ) { |
|
233 | + return; |
|
234 | + } |
|
228 | 235 | if( class_exists( '\GeminiLabs\Castor\Facades\Development' )) { |
229 | 236 | ob_start(); |
230 | 237 | \GeminiLabs\Castor\Facades\Development::printTemplatePaths(); |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function enqueueAssets() |
25 | 25 | { |
26 | - wp_enqueue_script( Application::ID, $this->app->url( 'assets/main.js' )); |
|
27 | - wp_enqueue_style( Application::ID, $this->app->url( 'assets/main.css' ), array( 'dashicons' )); |
|
28 | - wp_enqueue_style( Application::ID.'-syntax', $this->app->url( 'assets/syntax.css' )); |
|
26 | + wp_enqueue_script( Application::ID, $this->app->url( 'assets/main.js' ) ); |
|
27 | + wp_enqueue_style( Application::ID, $this->app->url( 'assets/main.css' ), array( 'dashicons' ) ); |
|
28 | + wp_enqueue_style( Application::ID . '-syntax', $this->app->url( 'assets/syntax.css' ) ); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function filterBodyClasses( $classes ) |
37 | 37 | { |
38 | - return trim( $classes.' '.Application::ID ); |
|
38 | + return trim( $classes . ' ' . Application::ID ); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function filterNoconflictScripts( $scripts ) |
46 | 46 | { |
47 | - $scripts[] = Application::ID; |
|
47 | + $scripts[ ] = Application::ID; |
|
48 | 48 | return $scripts; |
49 | 49 | } |
50 | 50 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function filterNoconflictStyles( $styles ) |
56 | 56 | { |
57 | - $styles[] = Application::ID; |
|
58 | - $styles[] = Application::ID.'-syntax'; |
|
57 | + $styles[ ] = Application::ID; |
|
58 | + $styles[ ] = Application::ID . '-syntax'; |
|
59 | 59 | return $styles; |
60 | 60 | } |
61 | 61 | |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function initProfiler() |
67 | 67 | { |
68 | - if( func_get_arg(0) != Application::DEBUG )return; |
|
69 | - $this->app->profiler->trace( func_get_arg(1) ); |
|
68 | + if( func_get_arg( 0 ) != Application::DEBUG )return; |
|
69 | + $this->app->profiler->trace( func_get_arg( 1 ) ); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | public function registerLanguages() |
77 | 77 | { |
78 | 78 | load_plugin_textdomain( Application::ID, false, |
79 | - plugin_basename( $this->app->path() ).Application::LANG |
|
79 | + plugin_basename( $this->app->path() ) . Application::LANG |
|
80 | 80 | ); |
81 | 81 | } |
82 | 82 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | 'queries' => $this->getQueries(), |
98 | 98 | 'queriesLabel' => $this->getQueriesLabel(), |
99 | 99 | 'templates' => $this->getTemplates(), |
100 | - )); |
|
100 | + ) ); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -115,18 +115,18 @@ discard block |
||
115 | 115 | { |
116 | 116 | $errors = array(); |
117 | 117 | foreach( $this->app->errors as $error ) { |
118 | - if( $error['errno'] == E_WARNING ) { |
|
119 | - $error['name'] = '<span class="glbb-error">'.$error['name'].'</span>'; |
|
118 | + if( $error[ 'errno' ] == E_WARNING ) { |
|
119 | + $error[ 'name' ] = '<span class="glbb-error">' . $error[ 'name' ] . '</span>'; |
|
120 | 120 | } |
121 | - if( $error['count'] > 1 ) { |
|
122 | - $error['name'] .= ' ('.$error['count'].')'; |
|
121 | + if( $error[ 'count' ] > 1 ) { |
|
122 | + $error[ 'name' ] .= ' (' . $error[ 'count' ] . ')'; |
|
123 | 123 | } |
124 | - $errors[] = array( |
|
125 | - 'name' => $error['name'], |
|
124 | + $errors[ ] = array( |
|
125 | + 'name' => $error[ 'name' ], |
|
126 | 126 | 'message' => sprintf( __( '%s on line %s in file %s', 'blackbar' ), |
127 | - $error['message'], |
|
128 | - $error['line'], |
|
129 | - $error['file'] |
|
127 | + $error[ 'message' ], |
|
128 | + $error[ 'line' ], |
|
129 | + $error[ 'file' ] |
|
130 | 130 | ), |
131 | 131 | ); |
132 | 132 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | $warningCount = 0; |
142 | 142 | foreach( $this->app->errors as $error ) { |
143 | - if( $error['errno'] == E_WARNING ) { |
|
143 | + if( $error[ 'errno' ] == E_WARNING ) { |
|
144 | 144 | $warningCount++; |
145 | 145 | } |
146 | 146 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $warnings = $warningCount > 0 |
149 | 149 | ? sprintf( ', %d!', $warningCount ) |
150 | 150 | : ''; |
151 | - return sprintf( __( 'Errors (%s)', 'blackbar' ), $errorCount.$warnings ); |
|
151 | + return sprintf( __( 'Errors (%s)', 'blackbar' ), $errorCount . $warnings ); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | $files = array_values( array_filter( get_included_files(), function( $file ) { |
160 | 160 | $bool = strpos( $file, '/themes/' ) !== false |
161 | 161 | && strpos( $file, '/functions.php' ) === false; |
162 | - return (bool)apply_filters( 'blackbar/templates/file', $bool, $file ); |
|
163 | - })); |
|
162 | + return (bool) apply_filters( 'blackbar/templates/file', $bool, $file ); |
|
163 | + }) ); |
|
164 | 164 | return array_map( function( $key, $value ) { |
165 | 165 | $value = str_replace( trailingslashit( WP_CONTENT_DIR ), '', $value ); |
166 | 166 | return sprintf( '[%s] => %s', $key, $value ); |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | 'ORDER BY', 'SET', 'WHERE', |
189 | 189 | ); |
190 | 190 | $replace = array_map( function( $value ) { |
191 | - return PHP_EOL.$value; |
|
191 | + return PHP_EOL . $value; |
|
192 | 192 | }, $search ); |
193 | 193 | foreach( $wpdb->queries as $query ) { |
194 | - $miliseconds = number_format( round( $query[1] * 1000, 4 ), 4 ); |
|
195 | - $sql = preg_replace( '/\s\s+/', ' ', trim( $query[0] )); |
|
194 | + $miliseconds = number_format( round( $query[ 1 ] * 1000, 4 ), 4 ); |
|
195 | + $sql = preg_replace( '/\s\s+/', ' ', trim( $query[ 0 ] ) ); |
|
196 | 196 | $sql = str_replace( PHP_EOL, ' ', $sql ); |
197 | 197 | $sql = str_replace( $search, $replace, $sql ); |
198 | - $queries[] = array( |
|
198 | + $queries[ ] = array( |
|
199 | 199 | 'ms' => $miliseconds, |
200 | 200 | 'sql' => $sql, |
201 | 201 | ); |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | global $wpdb; |
215 | 215 | $queryTime = 0; |
216 | 216 | foreach( $wpdb->queries as $query ) { |
217 | - $queryTime += $query[1]; |
|
217 | + $queryTime += $query[ 1 ]; |
|
218 | 218 | } |
219 | - $queriesCount = '<span class="glbb-queries-count">'.count( $wpdb->queries ).'</span>'; |
|
220 | - $queriesTime = '<span class="glbb-queries-time">'.$this->convertToMiliseconds( $queryTime ).'</span>'; |
|
219 | + $queriesCount = '<span class="glbb-queries-count">' . count( $wpdb->queries ) . '</span>'; |
|
220 | + $queriesTime = '<span class="glbb-queries-time">' . $this->convertToMiliseconds( $queryTime ) . '</span>'; |
|
221 | 221 | return sprintf( __( 'SQL (%s queries in %s ms)', 'blackbar' ), $queriesCount, $queriesTime ); |
222 | 222 | } |
223 | 223 | |
@@ -227,11 +227,11 @@ discard block |
||
227 | 227 | protected function getTemplates() |
228 | 228 | { |
229 | 229 | if( is_admin() )return; |
230 | - if( class_exists( '\GeminiLabs\Castor\Facades\Development' )) { |
|
230 | + if( class_exists( '\GeminiLabs\Castor\Facades\Development' ) ) { |
|
231 | 231 | ob_start(); |
232 | 232 | \GeminiLabs\Castor\Facades\Development::printTemplatePaths(); |
233 | 233 | return ob_get_clean(); |
234 | 234 | } |
235 | - return '<pre>'.implode( PHP_EOL, $this->getIncludedFiles() ).'</pre>'; |
|
235 | + return '<pre>' . implode( PHP_EOL, $this->getIncludedFiles() ) . '</pre>'; |
|
236 | 236 | } |
237 | 237 | } |