| @@ -31,19 +31,19 @@ discard block | ||
| 31 | 31 | * @param array $timer | 
| 32 | 32 | * @return string | 
| 33 | 33 | */ | 
| 34 | - public function getMemoryString( $timer ) | |
| 34 | + public function getMemoryString($timer) | |
| 35 | 35 |  	{ | 
| 36 | - $timer = $this->normalize( $timer ); | |
| 37 | - return sprintf( '%s %s', round( $timer['memory'] / 1000 ), __( 'kB', 'blackbar' )); | |
| 36 | + $timer = $this->normalize($timer); | |
| 37 | +		return sprintf('%s %s', round($timer['memory'] / 1000), __('kB', 'blackbar')); | |
| 38 | 38 | } | 
| 39 | 39 | |
| 40 | 40 | /** | 
| 41 | 41 | * @param array $timer | 
| 42 | 42 | * @return string | 
| 43 | 43 | */ | 
| 44 | - public function getNameString( $timer ) | |
| 44 | + public function getNameString($timer) | |
| 45 | 45 |  	{ | 
| 46 | - $timer = $this->normalize( $timer ); | |
| 46 | + $timer = $this->normalize($timer); | |
| 47 | 47 | return $timer['name']; | 
| 48 | 48 | } | 
| 49 | 49 | |
| @@ -59,11 +59,11 @@ discard block | ||
| 59 | 59 | * @param array $timer | 
| 60 | 60 | * @return string | 
| 61 | 61 | */ | 
| 62 | - public function getTimeString( $timer ) | |
| 62 | + public function getTimeString($timer) | |
| 63 | 63 |  	{ | 
| 64 | - $timer = $this->normalize( $timer ); | |
| 65 | - $time = number_format( round(( $timer['time'] - $this->start ) * 1000, 4 ), 4 ); | |
| 66 | - return sprintf( '%s %s', $time, __( 'ms', 'blackbar' )); | |
| 64 | + $timer = $this->normalize($timer); | |
| 65 | + $time = number_format(round(($timer['time'] - $this->start) * 1000, 4), 4); | |
| 66 | +		return sprintf('%s %s', $time, __('ms', 'blackbar')); | |
| 67 | 67 | } | 
| 68 | 68 | |
| 69 | 69 | /** | 
| @@ -77,10 +77,10 @@ discard block | ||
| 77 | 77 | /** | 
| 78 | 78 | * @param string $name | 
| 79 | 79 | */ | 
| 80 | - public function trace( $name ) | |
| 80 | + public function trace($name) | |
| 81 | 81 |  	{ | 
| 82 | - $microtime = microtime( true ); | |
| 83 | -		if( !$this->start ) { | |
| 82 | + $microtime = microtime(true); | |
| 83 | +		if (!$this->start) { | |
| 84 | 84 | $this->start = $microtime; | 
| 85 | 85 | } | 
| 86 | 86 | $this->timers[] = array( | 
| @@ -94,9 +94,9 @@ discard block | ||
| 94 | 94 | /** | 
| 95 | 95 | * @return array | 
| 96 | 96 | */ | 
| 97 | - protected function normalize( $timer ) | |
| 97 | + protected function normalize($timer) | |
| 98 | 98 |  	{ | 
| 99 | - return wp_parse_args( (array) $timer, array( | |
| 99 | + return wp_parse_args((array) $timer, array( | |
| 100 | 100 | 'name' => '', | 
| 101 | 101 | 'time' => 0, | 
| 102 | 102 | 'memory' => 0, | 
| @@ -16,7 +16,7 @@ discard block | ||
| 16 | 16 | |
| 17 | 17 | public function __construct() | 
| 18 | 18 |  	{ | 
| 19 | - $this->file = realpath( dirname( __DIR__ ).'/'.static::ID.'.php' ); | |
| 19 | + $this->file = realpath(dirname(__DIR__).'/'.static::ID.'.php'); | |
| 20 | 20 | $this->profiler = new Profiler; | 
| 21 | 21 | } | 
| 22 | 22 | |
| @@ -27,9 +27,9 @@ discard block | ||
| 27 | 27 | */ | 
| 28 | 28 | public function enqueueAssets() | 
| 29 | 29 |  	{ | 
| 30 | - wp_enqueue_script( static::ID, $this->url( 'assets/main.js' )); | |
| 31 | - wp_enqueue_style( static::ID, $this->url( 'assets/main.css' ), array( 'dashicons' )); | |
| 32 | - wp_enqueue_style( static::ID.'-syntax', $this->url( 'assets/syntax.css' )); | |
| 30 | +		wp_enqueue_script(static::ID, $this->url('assets/main.js')); | |
| 31 | +		wp_enqueue_style(static::ID, $this->url('assets/main.css'), array('dashicons')); | |
| 32 | +		wp_enqueue_style(static::ID.'-syntax', $this->url('assets/syntax.css')); | |
| 33 | 33 | } | 
| 34 | 34 | |
| 35 | 35 | /** | 
| @@ -39,7 +39,7 @@ discard block | ||
| 39 | 39 | * @param int $errline | 
| 40 | 40 | * @return void | 
| 41 | 41 | */ | 
| 42 | - public function errorHandler( $errno, $errstr, $errfile, $errline ) | |
| 42 | + public function errorHandler($errno, $errstr, $errfile, $errline) | |
| 43 | 43 |  	{ | 
| 44 | 44 | $errorCodes = array( | 
| 45 | 45 | 2 => 'Warning', | 
| @@ -47,11 +47,11 @@ discard block | ||
| 47 | 47 | 2048 => 'Strict', | 
| 48 | 48 | 8192 => 'Deprecated', | 
| 49 | 49 | ); | 
| 50 | - $errname = array_key_exists( $errno, $errorCodes ) | |
| 50 | + $errname = array_key_exists($errno, $errorCodes) | |
| 51 | 51 | ? $errorCodes[$errno] | 
| 52 | 52 | : 'Unknown'; | 
| 53 | - $hash = md5( $errno.$errstr.$errfile.$errline ); | |
| 54 | -		if( array_key_exists( $hash, $this->errors )) { | |
| 53 | + $hash = md5($errno.$errstr.$errfile.$errline); | |
| 54 | +		if (array_key_exists($hash, $this->errors)) { | |
| 55 | 55 | $this->errors[$hash]['count']++; | 
| 56 | 56 | } | 
| 57 | 57 |  		else { | 
| @@ -70,15 +70,15 @@ discard block | ||
| 70 | 70 | * @param string $classes | 
| 71 | 71 | * @return string | 
| 72 | 72 | */ | 
| 73 | - public function filterBodyClasses( $classes ) | |
| 73 | + public function filterBodyClasses($classes) | |
| 74 | 74 |  	{ | 
| 75 | - return trim( $classes.' '.static::ID ); | |
| 75 | + return trim($classes.' '.static::ID); | |
| 76 | 76 | } | 
| 77 | 77 | |
| 78 | 78 | /** | 
| 79 | 79 | * @return array | 
| 80 | 80 | */ | 
| 81 | - public function filterNoconflictScripts( $scripts ) | |
| 81 | + public function filterNoconflictScripts($scripts) | |
| 82 | 82 |  	{ | 
| 83 | 83 | $scripts[] = static::ID; | 
| 84 | 84 | return $scripts; | 
| @@ -87,7 +87,7 @@ discard block | ||
| 87 | 87 | /** | 
| 88 | 88 | * @return array | 
| 89 | 89 | */ | 
| 90 | - public function filterNoconflictStyles( $styles ) | |
| 90 | + public function filterNoconflictStyles($styles) | |
| 91 | 91 |  	{ | 
| 92 | 92 | $styles[] = static::ID; | 
| 93 | 93 | $styles[] = static::ID.'-syntax'; | 
| @@ -99,18 +99,18 @@ discard block | ||
| 99 | 99 | */ | 
| 100 | 100 | public function init() | 
| 101 | 101 |  	{ | 
| 102 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueueAssets' )); | |
| 103 | - add_action( 'admin_footer', array( $this, 'renderBar' )); | |
| 104 | - add_action( 'plugins_loaded', array( $this, 'registerLanguages' )); | |
| 105 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueueAssets' )); | |
| 106 | - add_action( 'wp_footer', array( $this, 'renderBar' )); | |
| 107 | - add_filter( 'admin_body_class', array( $this, 'filterBodyClasses' )); | |
| 108 | - add_filter( 'all', array( $this, 'initProfiler' )); | |
| 109 | - add_filter( 'gform_noconflict_scripts', array( $this, 'filterNoconflictScripts' ) ); | |
| 110 | - add_filter( 'gform_noconflict_styles', array( $this, 'filterNoconflictStyles' ) ); | |
| 111 | - apply_filters( 'debug', 'Profiler Initiated' ); | |
| 112 | - apply_filters( 'debug', 'Profiler Noise' ); | |
| 113 | - set_error_handler( array( $this, 'errorHandler' ), E_ALL|E_STRICT ); | |
| 102 | +		add_action('admin_enqueue_scripts', array($this, 'enqueueAssets')); | |
| 103 | +		add_action('admin_footer', array($this, 'renderBar')); | |
| 104 | +		add_action('plugins_loaded', array($this, 'registerLanguages')); | |
| 105 | +		add_action('wp_enqueue_scripts', array($this, 'enqueueAssets')); | |
| 106 | +		add_action('wp_footer', array($this, 'renderBar')); | |
| 107 | +		add_filter('admin_body_class', array($this, 'filterBodyClasses')); | |
| 108 | +		add_filter('all', array($this, 'initProfiler')); | |
| 109 | +		add_filter('gform_noconflict_scripts', array($this, 'filterNoconflictScripts')); | |
| 110 | +		add_filter('gform_noconflict_styles', array($this, 'filterNoconflictStyles')); | |
| 111 | +		apply_filters('debug', 'Profiler Initiated'); | |
| 112 | +		apply_filters('debug', 'Profiler Noise'); | |
| 113 | + set_error_handler(array($this, 'errorHandler'), E_ALL|E_STRICT); | |
| 114 | 114 | } | 
| 115 | 115 | |
| 116 | 116 | /** | 
| @@ -119,8 +119,8 @@ discard block | ||
| 119 | 119 | */ | 
| 120 | 120 | public function initProfiler() | 
| 121 | 121 |  	{ | 
| 122 | - if( func_get_arg(0) != static::DEBUG )return; | |
| 123 | - $this->profiler->trace( func_get_arg(1) ); | |
| 122 | + if (func_get_arg(0) != static::DEBUG)return; | |
| 123 | + $this->profiler->trace(func_get_arg(1)); | |
| 124 | 124 | } | 
| 125 | 125 | |
| 126 | 126 | /** | 
| @@ -128,7 +128,7 @@ discard block | ||
| 128 | 128 | */ | 
| 129 | 129 | public function registerLanguages() | 
| 130 | 130 |  	{ | 
| 131 | - load_plugin_textdomain( static::ID, false, plugin_basename( $this->path() ).static::LANG ); | |
| 131 | + load_plugin_textdomain(static::ID, false, plugin_basename($this->path()).static::LANG); | |
| 132 | 132 | } | 
| 133 | 133 | |
| 134 | 134 | /** | 
| @@ -137,11 +137,11 @@ discard block | ||
| 137 | 137 | * @param string $view | 
| 138 | 138 | * @return void | 
| 139 | 139 | */ | 
| 140 | - public function render( $view, array $data = array() ) | |
| 140 | + public function render($view, array $data = array()) | |
| 141 | 141 |  	{ | 
| 142 | - $file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ))); | |
| 143 | - if( !file_exists( $file ))return; | |
| 144 | - extract( $data ); | |
| 142 | +		$file = $this->path(sprintf('views/%s.php', str_replace('.php', '', $view))); | |
| 143 | + if (!file_exists($file))return; | |
| 144 | + extract($data); | |
| 145 | 145 | include $file; | 
| 146 | 146 | } | 
| 147 | 147 | |
| @@ -152,8 +152,8 @@ discard block | ||
| 152 | 152 | */ | 
| 153 | 153 | public function renderBar() | 
| 154 | 154 |  	{ | 
| 155 | - apply_filters( 'debug', 'Profiler Stopped' ); | |
| 156 | - $this->render( 'debug-bar', array( | |
| 155 | +		apply_filters('debug', 'Profiler Stopped'); | |
| 156 | +		$this->render('debug-bar', array( | |
| 157 | 157 | 'blackbar' => $this, | 
| 158 | 158 | 'errors' => $this->getErrors(), | 
| 159 | 159 | 'errorsLabel' => $this->getErrorsLabel(), | 
| @@ -167,9 +167,9 @@ discard block | ||
| 167 | 167 | /** | 
| 168 | 168 | * @return float | 
| 169 | 169 | */ | 
| 170 | - protected function convertToMiliseconds( $time, $decimals = 2 ) | |
| 170 | + protected function convertToMiliseconds($time, $decimals = 2) | |
| 171 | 171 |  	{ | 
| 172 | - return number_format( $time * 1000, $decimals ); | |
| 172 | + return number_format($time * 1000, $decimals); | |
| 173 | 173 | } | 
| 174 | 174 | |
| 175 | 175 | /** | 
| @@ -178,16 +178,16 @@ discard block | ||
| 178 | 178 | protected function getErrors() | 
| 179 | 179 |  	{ | 
| 180 | 180 | $errors = array(); | 
| 181 | -		foreach( $this->errors as $error ) { | |
| 182 | -			if( $error['errno'] == E_WARNING ) { | |
| 181 | +		foreach ($this->errors as $error) { | |
| 182 | +			if ($error['errno'] == E_WARNING) { | |
| 183 | 183 | $error['name'] = '<span class="glbb-error">'.$error['name'].'</span>'; | 
| 184 | 184 | } | 
| 185 | -			if( $error['count'] > 1 ) { | |
| 185 | +			if ($error['count'] > 1) { | |
| 186 | 186 |  				$error['name'] .= ' ('.$error['count'].')'; | 
| 187 | 187 | } | 
| 188 | 188 | $errors[] = array( | 
| 189 | 189 | 'name' => $error['name'], | 
| 190 | - 'message' => sprintf( __( '%s on line %s in file %s', 'blackbar' ), | |
| 190 | +				'message' => sprintf(__('%s on line %s in file %s', 'blackbar'), | |
| 191 | 191 | $error['message'], | 
| 192 | 192 | $error['line'], | 
| 193 | 193 | $error['file'] | 
| @@ -203,14 +203,14 @@ discard block | ||
| 203 | 203 | protected function getErrorsLabel() | 
| 204 | 204 |  	{ | 
| 205 | 205 | $warningCount = 0; | 
| 206 | -		foreach( $this->errors as $error ) { | |
| 207 | -			if( $error['errno'] == E_WARNING ) { | |
| 206 | +		foreach ($this->errors as $error) { | |
| 207 | +			if ($error['errno'] == E_WARNING) { | |
| 208 | 208 | $warningCount++; | 
| 209 | 209 | } | 
| 210 | 210 | } | 
| 211 | - $errorCount = count( $this->errors ); | |
| 212 | - $warnings = $warningCount > 0 ? sprintf( ', %d!', $warningCount ) : ''; | |
| 213 | - return sprintf( __( 'Errors (%d%s)', 'blackbar' ), $errorCount, $warnings ); | |
| 211 | + $errorCount = count($this->errors); | |
| 212 | +		$warnings = $warningCount > 0 ? sprintf(', %d!', $warningCount) : ''; | |
| 213 | +		return sprintf(__('Errors (%d%s)', 'blackbar'), $errorCount, $warnings); | |
| 214 | 214 | } | 
| 215 | 215 | |
| 216 | 216 | /** | 
| @@ -218,8 +218,8 @@ discard block | ||
| 218 | 218 | */ | 
| 219 | 219 | protected function getProfilerLabel() | 
| 220 | 220 |  	{ | 
| 221 | - $profilerTime = $this->convertToMiliseconds( $this->profiler->getTotalTime(), 0 ); | |
| 222 | - return sprintf( __( 'Profiler (%s ms)', 'blackbar' ), $profilerTime ); | |
| 221 | + $profilerTime = $this->convertToMiliseconds($this->profiler->getTotalTime(), 0); | |
| 222 | +		return sprintf(__('Profiler (%s ms)', 'blackbar'), $profilerTime); | |
| 223 | 223 | } | 
| 224 | 224 | |
| 225 | 225 | /** | 
| @@ -240,14 +240,14 @@ discard block | ||
| 240 | 240 | 'SET', | 
| 241 | 241 | 'WHERE', | 
| 242 | 242 | ); | 
| 243 | -		$replace = array_map( function( $value ) { | |
| 243 | +		$replace = array_map(function($value) { | |
| 244 | 244 | return PHP_EOL.$value; | 
| 245 | - }, $search ); | |
| 246 | -		foreach( $wpdb->queries as $query ) { | |
| 247 | - $miliseconds = number_format( round( $query[1] * 1000, 4 ), 4 ); | |
| 248 | - $sql = preg_replace( '/\s\s+/', ' ', trim( $query[0] )); | |
| 249 | - $sql = str_replace( PHP_EOL, ' ', $sql ); | |
| 250 | - $sql = str_replace( $search, $replace, $sql ); | |
| 245 | + }, $search); | |
| 246 | +		foreach ($wpdb->queries as $query) { | |
| 247 | + $miliseconds = number_format(round($query[1] * 1000, 4), 4); | |
| 248 | +			$sql = preg_replace('/\s\s+/', ' ', trim($query[0])); | |
| 249 | + $sql = str_replace(PHP_EOL, ' ', $sql); | |
| 250 | + $sql = str_replace($search, $replace, $sql); | |
| 251 | 251 | $queries[] = array( | 
| 252 | 252 | 'ms' => $miliseconds, | 
| 253 | 253 | 'sql' => $sql, | 
| @@ -263,29 +263,29 @@ discard block | ||
| 263 | 263 |  	{ | 
| 264 | 264 | global $wpdb; | 
| 265 | 265 | $queryTime = 0; | 
| 266 | -		foreach( $wpdb->queries as $query ) { | |
| 266 | +		foreach ($wpdb->queries as $query) { | |
| 267 | 267 | $queryTime += $query[1]; | 
| 268 | 268 | } | 
| 269 | - $queriesCount = '<span class="glbb-queries-count">'.count( $wpdb->queries ).'</span>'; | |
| 270 | - $queriesTime = '<span class="glbb-queries-time">'.$this->convertToMiliseconds( $queryTime ).'</span>'; | |
| 271 | - return sprintf( __( 'SQL (%s queries in %s ms)', 'blackbar' ), $queriesCount, $queriesTime ); | |
| 269 | + $queriesCount = '<span class="glbb-queries-count">'.count($wpdb->queries).'</span>'; | |
| 270 | + $queriesTime = '<span class="glbb-queries-time">'.$this->convertToMiliseconds($queryTime).'</span>'; | |
| 271 | +		return sprintf(__('SQL (%s queries in %s ms)', 'blackbar'), $queriesCount, $queriesTime); | |
| 272 | 272 | } | 
| 273 | 273 | |
| 274 | 274 | /** | 
| 275 | 275 | * @param string $file | 
| 276 | 276 | * @return string | 
| 277 | 277 | */ | 
| 278 | - protected function path( $file = '' ) | |
| 278 | + protected function path($file = '') | |
| 279 | 279 |  	{ | 
| 280 | - return plugin_dir_path( $this->file ).ltrim( trim( $file ), '/' ); | |
| 280 | + return plugin_dir_path($this->file).ltrim(trim($file), '/'); | |
| 281 | 281 | } | 
| 282 | 282 | |
| 283 | 283 | /** | 
| 284 | 284 | * @param string $path | 
| 285 | 285 | * @return string | 
| 286 | 286 | */ | 
| 287 | - protected function url( $path = '' ) | |
| 287 | + protected function url($path = '') | |
| 288 | 288 |  	{ | 
| 289 | - return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' )); | |
| 289 | + return esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/')); | |
| 290 | 290 | } | 
| 291 | 291 | } | 
| @@ -53,8 +53,7 @@ discard block | ||
| 53 | 53 | $hash = md5( $errno.$errstr.$errfile.$errline ); | 
| 54 | 54 |  		if( array_key_exists( $hash, $this->errors )) { | 
| 55 | 55 | $this->errors[$hash]['count']++; | 
| 56 | - } | |
| 57 | -		else { | |
| 56 | +		} else { | |
| 58 | 57 | $this->errors[$hash] = array( | 
| 59 | 58 | "errno" => $errno, | 
| 60 | 59 | "message" => $errstr, | 
| @@ -119,7 +118,9 @@ discard block | ||
| 119 | 118 | */ | 
| 120 | 119 | public function initProfiler() | 
| 121 | 120 |  	{ | 
| 122 | - if( func_get_arg(0) != static::DEBUG )return; | |
| 121 | +		if( func_get_arg(0) != static::DEBUG ) { | |
| 122 | + return; | |
| 123 | + } | |
| 123 | 124 | $this->profiler->trace( func_get_arg(1) ); | 
| 124 | 125 | } | 
| 125 | 126 | |
| @@ -140,7 +141,9 @@ discard block | ||
| 140 | 141 | public function render( $view, array $data = array() ) | 
| 141 | 142 |  	{ | 
| 142 | 143 | $file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ))); | 
| 143 | - if( !file_exists( $file ))return; | |
| 144 | +		if( !file_exists( $file )) { | |
| 145 | + return; | |
| 146 | + } | |
| 144 | 147 | extract( $data ); | 
| 145 | 148 | include $file; | 
| 146 | 149 | } | 
| @@ -1,3 +1,3 @@ | ||
| 1 | -<?php defined( 'WPINC' ) || die; | |
| 1 | +<?php defined('WPINC') || die; | |
| 2 | 2 | |
| 3 | 3 | Development::printTemplatePaths(); | 
| @@ -1,7 +1,7 @@ | ||
| 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/> | |
| @@ -1,12 +1,12 @@ | ||
| 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-number"><?= $profiler->getTimeString( $timer ); ?></td> | |
| 9 | - <td><?= $profiler->getMemoryString( $timer ); ?></td> | |
| 7 | + <td><?= $profiler->getNameString($timer); ?></td> | |
| 8 | + <td class="glbb-number"><?= $profiler->getTimeString($timer); ?></td> | |
| 9 | + <td><?= $profiler->getMemoryString($timer); ?></td> | |
| 10 | 10 | </tr> | 
| 11 | 11 | <?php endforeach; ?> | 
| 12 | 12 | </tbody> | 
| @@ -1,12 +1,12 @@ | ||
| 1 | -<?php defined( 'WPINC' ) || die; ?> | |
| 1 | +<?php defined('WPINC') || die; ?> | |
| 2 | 2 | |
| 3 | 3 | <form method="get" class="glbb-queries-filter"> | 
| 4 | - <input type="text" name="glbb_query_filter" id="glbb_query_filter" placeholder="<?= __( 'Find queries containing', 'blackbar' ); ?>"> | |
| 5 | - <input type="text" name="glbb_query_min_time" id="glbb_query_min_time" placeholder="<?= __( 'Minimum Execution Time', 'blackbar' ); ?>"> | |
| 4 | +	<input type="text" name="glbb_query_filter" id="glbb_query_filter" placeholder="<?= __('Find queries containing', 'blackbar'); ?>"> | |
| 5 | +	<input type="text" name="glbb_query_min_time" id="glbb_query_min_time" placeholder="<?= __('Minimum Execution Time', 'blackbar'); ?>"> | |
| 6 | 6 | </form> | 
| 7 | 7 | <table> | 
| 8 | 8 | <tbody> | 
| 9 | - <?php foreach( $queries as $query ) : ?> | |
| 9 | + <?php foreach ($queries as $query) : ?> | |
| 10 | 10 | <tr> | 
| 11 | 11 | <td class="glbb-number"><?= $query['ms']; ?></td> | 
| 12 | 12 | <td><pre><code class="sql"><?= $query['sql']; ?></code></pre></td> | 
| @@ -1,8 +1,8 @@ | ||
| 1 | -<?php defined( 'WPINC' ) || die; ?> | |
| 1 | +<?php defined('WPINC') || die; ?> | |
| 2 | 2 | |
| 3 | 3 | <table> | 
| 4 | 4 | <tbody> | 
| 5 | - <?php foreach( $errors as $error ) : ?> | |
| 5 | + <?php foreach ($errors as $error) : ?> | |
| 6 | 6 | <tr> | 
| 7 | 7 | <td><?= $error['name']; ?></td> | 
| 8 | 8 | <td><?= $error['message']; ?></td> | 
| @@ -1,32 +1,32 @@ | ||
| 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> | 
| @@ -1,21 +1,21 @@ | ||
| 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 | } | 
| @@ -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 | } |