@@ -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,16 +44,16 @@ 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 | $args = array_pad( func_get_args(), 4, '' ); |
| 49 | 49 | $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 4 ); |
| 50 | 50 | $entry = array_pop( $backtrace ); |
| 51 | - $location = $args[3]; |
|
| 52 | - if( empty( trim( $location )) && array_key_exists( 'file', $entry )) { |
|
| 53 | - $path = explode( ABSPATH, $entry['file'] ); |
|
| 54 | - $location = sprintf( '%s:%s', array_pop( $path ), $entry['line'] ); |
|
| 51 | + $location = $args[ 3 ]; |
|
| 52 | + if( empty( trim( $location ) ) && array_key_exists( 'file', $entry ) ) { |
|
| 53 | + $path = explode( ABSPATH, $entry[ 'file' ] ); |
|
| 54 | + $location = sprintf( '%s:%s', array_pop( $path ), $entry[ 'line' ] ); |
|
| 55 | 55 | } |
| 56 | - $this->app->console->store( $args[1], $args[2], '['.$location.'] ' ); |
|
| 56 | + $this->app->console->store( $args[ 1 ], $args[ 2 ], '[' . $location . '] ' ); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function initProfiler() |
| 64 | 64 | { |
| 65 | - if( func_get_arg(0) != Application::PROFILER_HOOK )return; |
|
| 66 | - $this->app->profiler->trace( func_get_arg(1) ); |
|
| 65 | + if( func_get_arg( 0 ) != Application::PROFILER_HOOK )return; |
|
| 66 | + $this->app->profiler->trace( func_get_arg( 1 ) ); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public function registerLanguages() |
| 74 | 74 | { |
| 75 | 75 | load_plugin_textdomain( Application::ID, false, |
| 76 | - plugin_basename( $this->app->path() ).Application::LANG |
|
| 76 | + plugin_basename( $this->app->path() ) . Application::LANG |
|
| 77 | 77 | ); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | 'queries' => $this->getQueries(), |
| 95 | 95 | 'queriesLabel' => $this->getQueriesLabel(), |
| 96 | 96 | 'templates' => $this->getTemplates(), |
| 97 | - )); |
|
| 97 | + ) ); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | $entries = $this->getConsoleEntries(); |
| 125 | 125 | $errorCount = 0; |
| 126 | 126 | foreach( $entries as $entry ) { |
| 127 | - if( in_array( $entry['errno'], [E_NOTICE, E_STRICT, E_DEPRECATED] )) { |
|
| 127 | + if( in_array( $entry[ 'errno' ], [ E_NOTICE, E_STRICT, E_DEPRECATED ] ) ) { |
|
| 128 | 128 | $class = 'glbb-warning'; |
| 129 | 129 | } |
| 130 | - if( in_array( $entry['errno'], [E_WARNING] )) { |
|
| 130 | + if( in_array( $entry[ 'errno' ], [ E_WARNING ] ) ) { |
|
| 131 | 131 | $errorCount++; |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | $entryCount .= sprintf( ', %d!', $errorCount ); |
| 138 | 138 | } |
| 139 | 139 | $label = sprintf( __( 'Console (%s)', 'blackbar' ), $entryCount ); |
| 140 | - return '<span class="'.$class.'">'.$label.'</span>'; |
|
| 140 | + return '<span class="' . $class . '">' . $label . '</span>'; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -148,22 +148,22 @@ discard block |
||
| 148 | 148 | $errors = array(); |
| 149 | 149 | foreach( $this->app->errors as $error ) { |
| 150 | 150 | $class = 'glbb-info'; |
| 151 | - if( in_array( $error['errno'], [E_NOTICE, E_STRICT, E_DEPRECATED] )) { |
|
| 151 | + if( in_array( $error[ 'errno' ], [ E_NOTICE, E_STRICT, E_DEPRECATED ] ) ) { |
|
| 152 | 152 | $class = 'glbb-warning'; |
| 153 | 153 | } |
| 154 | - if( $error['errno'] == E_WARNING ) { |
|
| 154 | + if( $error[ 'errno' ] == E_WARNING ) { |
|
| 155 | 155 | $class = 'glbb-error'; |
| 156 | 156 | } |
| 157 | - if( $error['count'] > 1 ) { |
|
| 158 | - $error['name'] .= ' ('.$error['count'].')'; |
|
| 157 | + if( $error[ 'count' ] > 1 ) { |
|
| 158 | + $error[ 'name' ] .= ' (' . $error[ 'count' ] . ')'; |
|
| 159 | 159 | } |
| 160 | - $errors[] = array( |
|
| 161 | - 'errno' => $error['errno'], |
|
| 162 | - 'name' => '<span class="'.$class.'">'.$error['name'].'</span>', |
|
| 160 | + $errors[ ] = array( |
|
| 161 | + 'errno' => $error[ 'errno' ], |
|
| 162 | + 'name' => '<span class="' . $class . '">' . $error[ 'name' ] . '</span>', |
|
| 163 | 163 | 'message' => sprintf( __( '%s on line %s in file %s', 'blackbar' ), |
| 164 | - $error['message'], |
|
| 165 | - $error['line'], |
|
| 166 | - $error['file'] |
|
| 164 | + $error[ 'message' ], |
|
| 165 | + $error[ 'line' ], |
|
| 166 | + $error[ 'file' ] |
|
| 167 | 167 | ), |
| 168 | 168 | ); |
| 169 | 169 | } |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | $files = array_values( array_filter( get_included_files(), function( $file ) { |
| 179 | 179 | $bool = strpos( $file, '/themes/' ) !== false |
| 180 | 180 | && strpos( $file, '/functions.php' ) === false; |
| 181 | - return (bool)apply_filters( 'blackbar/templates/file', $bool, $file ); |
|
| 182 | - })); |
|
| 181 | + return (bool) apply_filters( 'blackbar/templates/file', $bool, $file ); |
|
| 182 | + }) ); |
|
| 183 | 183 | return array_map( function( $key, $value ) { |
| 184 | 184 | $value = str_replace( trailingslashit( WP_CONTENT_DIR ), '', $value ); |
| 185 | 185 | return sprintf( '[%s] => %s', $key, $value ); |
@@ -207,14 +207,14 @@ discard block |
||
| 207 | 207 | 'ORDER BY', 'SET', 'WHERE', |
| 208 | 208 | ); |
| 209 | 209 | $replace = array_map( function( $value ) { |
| 210 | - return PHP_EOL.$value; |
|
| 210 | + return PHP_EOL . $value; |
|
| 211 | 211 | }, $search ); |
| 212 | 212 | foreach( $wpdb->queries as $query ) { |
| 213 | - $miliseconds = number_format( round( $query[1] * 1000, 4 ), 4 ); |
|
| 214 | - $sql = preg_replace( '/\s\s+/', ' ', trim( $query[0] )); |
|
| 213 | + $miliseconds = number_format( round( $query[ 1 ] * 1000, 4 ), 4 ); |
|
| 214 | + $sql = preg_replace( '/\s\s+/', ' ', trim( $query[ 0 ] ) ); |
|
| 215 | 215 | $sql = str_replace( PHP_EOL, ' ', $sql ); |
| 216 | 216 | $sql = str_replace( $search, $replace, $sql ); |
| 217 | - $queries[] = array( |
|
| 217 | + $queries[ ] = array( |
|
| 218 | 218 | 'ms' => $miliseconds, |
| 219 | 219 | 'sql' => $sql, |
| 220 | 220 | ); |
@@ -233,10 +233,10 @@ discard block |
||
| 233 | 233 | global $wpdb; |
| 234 | 234 | $queryTime = 0; |
| 235 | 235 | foreach( $wpdb->queries as $query ) { |
| 236 | - $queryTime += $query[1]; |
|
| 236 | + $queryTime += $query[ 1 ]; |
|
| 237 | 237 | } |
| 238 | - $queriesCount = '<span class="glbb-queries-count">'.count( $wpdb->queries ).'</span>'; |
|
| 239 | - $queriesTime = '<span class="glbb-queries-time">'.$this->convertToMiliseconds( $queryTime ).'</span>'; |
|
| 238 | + $queriesCount = '<span class="glbb-queries-count">' . count( $wpdb->queries ) . '</span>'; |
|
| 239 | + $queriesTime = '<span class="glbb-queries-time">' . $this->convertToMiliseconds( $queryTime ) . '</span>'; |
|
| 240 | 240 | return sprintf( __( 'SQL (%s queries | %s ms)', 'blackbar' ), $queriesCount, $queriesTime ); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -246,11 +246,11 @@ discard block |
||
| 246 | 246 | protected function getTemplates() |
| 247 | 247 | { |
| 248 | 248 | if( is_admin() )return; |
| 249 | - if( class_exists( '\GeminiLabs\Castor\Facades\Development' )) { |
|
| 249 | + if( class_exists( '\GeminiLabs\Castor\Facades\Development' ) ) { |
|
| 250 | 250 | ob_start(); |
| 251 | 251 | \GeminiLabs\Castor\Facades\Development::printTemplatePaths(); |
| 252 | 252 | return ob_get_clean(); |
| 253 | 253 | } |
| 254 | - return '<pre>'.implode( PHP_EOL, $this->getIncludedFiles() ).'</pre>'; |
|
| 254 | + return '<pre>' . implode( PHP_EOL, $this->getIncludedFiles() ) . '</pre>'; |
|
| 255 | 255 | } |
| 256 | 256 | } |