@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function store( $message, $location = '' ) |
| 17 | 17 | { |
| 18 | - $this->entries[] = array( |
|
| 18 | + $this->entries[ ] = array( |
|
| 19 | 19 | 'errno' => 0, |
| 20 | - 'message' => $location.$this->normalizeValue( $message ), |
|
| 20 | + 'message' => $location . $this->normalizeValue( $message ), |
|
| 21 | 21 | 'name' => '<span class="glbb-info">Debug</span>', |
| 22 | 22 | ); |
| 23 | 23 | return $this; |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | if( $value instanceof DateTime ) { |
| 42 | 42 | $value = $value->format( 'Y-m-d H:i:s' ); |
| 43 | 43 | } |
| 44 | - else if( $this->isObjectOrArray( $value )) { |
|
| 45 | - $value = print_r( json_decode( json_encode( $value )), true ); |
|
| 44 | + else if( $this->isObjectOrArray( $value ) ) { |
|
| 45 | + $value = print_r( json_decode( json_encode( $value ) ), true ); |
|
| 46 | 46 | } |
| 47 | - else if( is_resource( $value )) { |
|
| 48 | - $value = (string)$value; |
|
| 47 | + else if( is_resource( $value ) ) { |
|
| 48 | + $value = (string) $value; |
|
| 49 | 49 | } |
| 50 | 50 | return esc_html( $value ); |
| 51 | 51 | } |
@@ -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,15 +44,15 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function initConsole() |
| 46 | 46 | { |
| 47 | - if( func_get_arg(0) != Application::CONSOLE_HOOK )return; |
|
| 47 | + if( func_get_arg( 0 ) != Application::CONSOLE_HOOK )return; |
|
| 48 | 48 | $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 4 ); |
| 49 | 49 | $entry = array_pop( $backtrace ); |
| 50 | 50 | $location = ''; |
| 51 | - if( array_key_exists( 'file', $entry )) { |
|
| 52 | - $path = explode( ABSPATH, $entry['file'] ); |
|
| 53 | - $location = sprintf( '[%s:%s] ', array_pop( $path ), $entry['line'] ); |
|
| 51 | + if( array_key_exists( 'file', $entry ) ) { |
|
| 52 | + $path = explode( ABSPATH, $entry[ 'file' ] ); |
|
| 53 | + $location = sprintf( '[%s:%s] ', array_pop( $path ), $entry[ 'line' ] ); |
|
| 54 | 54 | } |
| 55 | - $this->app->console->store( func_get_arg(1), $location ); |
|
| 55 | + $this->app->console->store( func_get_arg( 1 ), $location ); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public function initProfiler() |
| 63 | 63 | { |
| 64 | - if( func_get_arg(0) != Application::PROFILER_HOOK )return; |
|
| 65 | - $this->app->profiler->trace( func_get_arg(1) ); |
|
| 64 | + if( func_get_arg( 0 ) != Application::PROFILER_HOOK )return; |
|
| 65 | + $this->app->profiler->trace( func_get_arg( 1 ) ); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | public function registerLanguages() |
| 73 | 73 | { |
| 74 | 74 | load_plugin_textdomain( Application::ID, false, |
| 75 | - plugin_basename( $this->app->path() ).Application::LANG |
|
| 75 | + plugin_basename( $this->app->path() ) . Application::LANG |
|
| 76 | 76 | ); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | 'queries' => $this->getQueries(), |
| 94 | 94 | 'queriesLabel' => $this->getQueriesLabel(), |
| 95 | 95 | 'templates' => $this->getTemplates(), |
| 96 | - )); |
|
| 96 | + ) ); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -123,10 +123,10 @@ discard block |
||
| 123 | 123 | $entries = $this->getConsoleEntries(); |
| 124 | 124 | $errorCount = 0; |
| 125 | 125 | foreach( $entries as $entry ) { |
| 126 | - if( in_array( $entry['errno'], [E_NOTICE, E_STRICT, E_DEPRECATED] )) { |
|
| 126 | + if( in_array( $entry[ 'errno' ], [ E_NOTICE, E_STRICT, E_DEPRECATED ] ) ) { |
|
| 127 | 127 | $class = 'glbb-warning'; |
| 128 | 128 | } |
| 129 | - if( in_array( $entry['errno'], [E_WARNING] )) { |
|
| 129 | + if( in_array( $entry[ 'errno' ], [ E_WARNING ] ) ) { |
|
| 130 | 130 | $errorCount++; |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $entryCount .= sprintf( ', %d!', $errorCount ); |
| 137 | 137 | } |
| 138 | 138 | $label = sprintf( __( 'Console (%s)', 'blackbar' ), $entryCount ); |
| 139 | - return '<span class="'.$class.'">'.$label.'</span>'; |
|
| 139 | + return '<span class="' . $class . '">' . $label . '</span>'; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -147,22 +147,22 @@ discard block |
||
| 147 | 147 | $errors = array(); |
| 148 | 148 | foreach( $this->app->errors as $error ) { |
| 149 | 149 | $class = 'glbb-info'; |
| 150 | - if( in_array( $error['errno'], [E_NOTICE, E_STRICT, E_DEPRECATED] )) { |
|
| 150 | + if( in_array( $error[ 'errno' ], [ E_NOTICE, E_STRICT, E_DEPRECATED ] ) ) { |
|
| 151 | 151 | $class = 'glbb-warning'; |
| 152 | 152 | } |
| 153 | - if( $error['errno'] == E_WARNING ) { |
|
| 153 | + if( $error[ 'errno' ] == E_WARNING ) { |
|
| 154 | 154 | $class = 'glbb-error'; |
| 155 | 155 | } |
| 156 | - if( $error['count'] > 1 ) { |
|
| 157 | - $error['name'] .= ' ('.$error['count'].')'; |
|
| 156 | + if( $error[ 'count' ] > 1 ) { |
|
| 157 | + $error[ 'name' ] .= ' (' . $error[ 'count' ] . ')'; |
|
| 158 | 158 | } |
| 159 | - $errors[] = array( |
|
| 160 | - 'errno' => $error['errno'], |
|
| 161 | - 'name' => '<span class="'.$class.'">'.$error['name'].'</span>', |
|
| 159 | + $errors[ ] = array( |
|
| 160 | + 'errno' => $error[ 'errno' ], |
|
| 161 | + 'name' => '<span class="' . $class . '">' . $error[ 'name' ] . '</span>', |
|
| 162 | 162 | 'message' => sprintf( __( '%s on line %s in file %s', 'blackbar' ), |
| 163 | - $error['message'], |
|
| 164 | - $error['line'], |
|
| 165 | - $error['file'] |
|
| 163 | + $error[ 'message' ], |
|
| 164 | + $error[ 'line' ], |
|
| 165 | + $error[ 'file' ] |
|
| 166 | 166 | ), |
| 167 | 167 | ); |
| 168 | 168 | } |
@@ -177,8 +177,8 @@ discard block |
||
| 177 | 177 | $files = array_values( array_filter( get_included_files(), function( $file ) { |
| 178 | 178 | $bool = strpos( $file, '/themes/' ) !== false |
| 179 | 179 | && strpos( $file, '/functions.php' ) === false; |
| 180 | - return (bool)apply_filters( 'blackbar/templates/file', $bool, $file ); |
|
| 181 | - })); |
|
| 180 | + return (bool) apply_filters( 'blackbar/templates/file', $bool, $file ); |
|
| 181 | + }) ); |
|
| 182 | 182 | return array_map( function( $key, $value ) { |
| 183 | 183 | $value = str_replace( trailingslashit( WP_CONTENT_DIR ), '', $value ); |
| 184 | 184 | return sprintf( '[%s] => %s', $key, $value ); |
@@ -206,14 +206,14 @@ discard block |
||
| 206 | 206 | 'ORDER BY', 'SET', 'WHERE', |
| 207 | 207 | ); |
| 208 | 208 | $replace = array_map( function( $value ) { |
| 209 | - return PHP_EOL.$value; |
|
| 209 | + return PHP_EOL . $value; |
|
| 210 | 210 | }, $search ); |
| 211 | 211 | foreach( $wpdb->queries as $query ) { |
| 212 | - $miliseconds = number_format( round( $query[1] * 1000, 4 ), 4 ); |
|
| 213 | - $sql = preg_replace( '/\s\s+/', ' ', trim( $query[0] )); |
|
| 212 | + $miliseconds = number_format( round( $query[ 1 ] * 1000, 4 ), 4 ); |
|
| 213 | + $sql = preg_replace( '/\s\s+/', ' ', trim( $query[ 0 ] ) ); |
|
| 214 | 214 | $sql = str_replace( PHP_EOL, ' ', $sql ); |
| 215 | 215 | $sql = str_replace( $search, $replace, $sql ); |
| 216 | - $queries[] = array( |
|
| 216 | + $queries[ ] = array( |
|
| 217 | 217 | 'ms' => $miliseconds, |
| 218 | 218 | 'sql' => $sql, |
| 219 | 219 | ); |
@@ -232,10 +232,10 @@ discard block |
||
| 232 | 232 | global $wpdb; |
| 233 | 233 | $queryTime = 0; |
| 234 | 234 | foreach( $wpdb->queries as $query ) { |
| 235 | - $queryTime += $query[1]; |
|
| 235 | + $queryTime += $query[ 1 ]; |
|
| 236 | 236 | } |
| 237 | - $queriesCount = '<span class="glbb-queries-count">'.count( $wpdb->queries ).'</span>'; |
|
| 238 | - $queriesTime = '<span class="glbb-queries-time">'.$this->convertToMiliseconds( $queryTime ).'</span>'; |
|
| 237 | + $queriesCount = '<span class="glbb-queries-count">' . count( $wpdb->queries ) . '</span>'; |
|
| 238 | + $queriesTime = '<span class="glbb-queries-time">' . $this->convertToMiliseconds( $queryTime ) . '</span>'; |
|
| 239 | 239 | return sprintf( __( 'SQL (%s queries | %s ms)', 'blackbar' ), $queriesCount, $queriesTime ); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -245,11 +245,11 @@ discard block |
||
| 245 | 245 | protected function getTemplates() |
| 246 | 246 | { |
| 247 | 247 | if( is_admin() )return; |
| 248 | - if( class_exists( '\GeminiLabs\Castor\Facades\Development' )) { |
|
| 248 | + if( class_exists( '\GeminiLabs\Castor\Facades\Development' ) ) { |
|
| 249 | 249 | ob_start(); |
| 250 | 250 | \GeminiLabs\Castor\Facades\Development::printTemplatePaths(); |
| 251 | 251 | return ob_get_clean(); |
| 252 | 252 | } |
| 253 | - return '<pre>'.implode( PHP_EOL, $this->getIncludedFiles() ).'</pre>'; |
|
| 253 | + return '<pre>' . implode( PHP_EOL, $this->getIncludedFiles() ) . '</pre>'; |
|
| 254 | 254 | } |
| 255 | 255 | } |
@@ -18,14 +18,14 @@ |
||
| 18 | 18 | |
| 19 | 19 | defined( 'WPINC' ) || die; |
| 20 | 20 | |
| 21 | -if( !class_exists( 'GL_Plugin_Check_v3' )) { |
|
| 22 | - require_once __DIR__.'/activate.php'; |
|
| 21 | +if( !class_exists( 'GL_Plugin_Check_v3' ) ) { |
|
| 22 | + require_once __DIR__ . '/activate.php'; |
|
| 23 | 23 | } |
| 24 | -if( !(new GL_Plugin_Check_v3( __FILE__, array( 'php' => '5.6', 'wordpress' => '4.7.0' )))->canProceed() )return; |
|
| 25 | -require_once __DIR__.'/autoload.php'; |
|
| 26 | -require_once __DIR__.'/compatibility.php'; |
|
| 24 | +if( !( new GL_Plugin_Check_v3( __FILE__, array( 'php' => '5.6', 'wordpress' => '4.7.0' ) ) )->canProceed() )return; |
|
| 25 | +require_once __DIR__ . '/autoload.php'; |
|
| 26 | +require_once __DIR__ . '/compatibility.php'; |
|
| 27 | 27 | |
| 28 | -if( !defined( 'SAVEQUERIES' )) { |
|
| 28 | +if( !defined( 'SAVEQUERIES' ) ) { |
|
| 29 | 29 | define( 'SAVEQUERIES', 1 ); |
| 30 | 30 | } |
| 31 | -(new GeminiLabs\BlackBar\Application)->init(); |
|
| 31 | +( new GeminiLabs\BlackBar\Application )->init(); |
|