@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -defined( 'WPINC' ) || die; |
|
3 | +defined('WPINC') || die; |
|
4 | 4 | |
5 | 5 | class GL_BlackBar_Activate |
6 | 6 | { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public static function isPhpValid() |
28 | 28 | { |
29 | - return !version_compare( PHP_VERSION, static::MIN_PHP_VERSION, '<' ); |
|
29 | + return !version_compare(PHP_VERSION, static::MIN_PHP_VERSION, '<'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public static function isWpValid() |
36 | 36 | { |
37 | 37 | global $wp_version; |
38 | - return !version_compare( $wp_version, static::MIN_WORDPRESS_VERSION, '<' ); |
|
38 | + return !version_compare($wp_version, static::MIN_WORDPRESS_VERSION, '<'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public static function shouldDeactivate() |
45 | 45 | { |
46 | - if( empty( static::$instance )) { |
|
46 | + if (empty(static::$instance)) { |
|
47 | 47 | static::$instance = new static; |
48 | 48 | } |
49 | - if( !static::isValid() ) { |
|
50 | - add_action( 'activated_plugin', array( static::$instance, 'deactivate' )); |
|
51 | - add_action( 'admin_notices', array( static::$instance, 'deactivate' )); |
|
49 | + if (!static::isValid()) { |
|
50 | + add_action('activated_plugin', array(static::$instance, 'deactivate')); |
|
51 | + add_action('admin_notices', array(static::$instance, 'deactivate')); |
|
52 | 52 | return true; |
53 | 53 | } |
54 | 54 | return false; |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | /** |
58 | 58 | * @return void |
59 | 59 | */ |
60 | - public function deactivate( $plugin ) |
|
60 | + public function deactivate($plugin) |
|
61 | 61 | { |
62 | - if( static::isValid() )return; |
|
63 | - $pluginName = plugin_basename( dirname( realpath( __FILE__ )).'/'.static::BASENAME ); |
|
64 | - if( $plugin == $pluginName ) { |
|
62 | + if (static::isValid())return; |
|
63 | + $pluginName = plugin_basename(dirname(realpath(__FILE__)).'/'.static::BASENAME); |
|
64 | + if ($plugin == $pluginName) { |
|
65 | 65 | $this->redirect(); //exit |
66 | 66 | } |
67 | - deactivate_plugins( $pluginName ); |
|
67 | + deactivate_plugins($pluginName); |
|
68 | 68 | $this->printNotice(); |
69 | 69 | } |
70 | 70 | |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | */ |
74 | 74 | protected function redirect() |
75 | 75 | { |
76 | - wp_safe_redirect( self_admin_url( sprintf( 'plugins.php?plugin_status=%s&paged=%s&s=%s', |
|
77 | - filter_input( INPUT_GET, 'plugin_status' ), |
|
78 | - filter_input( INPUT_GET, 'paged' ), |
|
79 | - filter_input( INPUT_GET, 's' ) |
|
76 | + wp_safe_redirect(self_admin_url(sprintf('plugins.php?plugin_status=%s&paged=%s&s=%s', |
|
77 | + filter_input(INPUT_GET, 'plugin_status'), |
|
78 | + filter_input(INPUT_GET, 'paged'), |
|
79 | + filter_input(INPUT_GET, 's') |
|
80 | 80 | ))); |
81 | 81 | exit; |
82 | 82 | } |
@@ -88,25 +88,25 @@ discard block |
||
88 | 88 | { |
89 | 89 | $noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>'; |
90 | 90 | $messages = array( |
91 | - __( 'The Black Bar plugin was deactivated.', 'blackbar' ), |
|
92 | - __( 'Sorry, this plugin requires %s or greater in order to work properly.', 'blackbar' ), |
|
93 | - __( 'Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'blackbar' ), |
|
94 | - __( 'PHP version', 'blackbar' ).' '.static::MIN_PHP_VERSION, |
|
95 | - __( 'WordPress version', 'blackbar' ).' '.static::MIN_WORDPRESS_VERSION, |
|
96 | - __( 'Update WordPress', 'blackbar' ), |
|
91 | + __('The Black Bar plugin was deactivated.', 'blackbar'), |
|
92 | + __('Sorry, this plugin requires %s or greater in order to work properly.', 'blackbar'), |
|
93 | + __('Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'blackbar'), |
|
94 | + __('PHP version', 'blackbar').' '.static::MIN_PHP_VERSION, |
|
95 | + __('WordPress version', 'blackbar').' '.static::MIN_WORDPRESS_VERSION, |
|
96 | + __('Update WordPress', 'blackbar'), |
|
97 | 97 | ); |
98 | - if( !static::isPhpValid() ) { |
|
99 | - printf( $noticeTemplate, |
|
98 | + if (!static::isPhpValid()) { |
|
99 | + printf($noticeTemplate, |
|
100 | 100 | $messages[0], |
101 | - sprintf( $messages[1], $messages[3] ), |
|
102 | - sprintf( $messages[2], PHP_VERSION ) |
|
101 | + sprintf($messages[1], $messages[3]), |
|
102 | + sprintf($messages[2], PHP_VERSION) |
|
103 | 103 | ); |
104 | 104 | } |
105 | - else if( !static::isWpValid() ) { |
|
106 | - printf( $noticeTemplate, |
|
105 | + else if (!static::isWpValid()) { |
|
106 | + printf($noticeTemplate, |
|
107 | 107 | $messages[0], |
108 | - sprintf( $messages[1], $messages[4] ), |
|
109 | - sprintf( '<a href="%s">%s</a>', admin_url( 'update-core.php' ), $messages[5] ) |
|
108 | + sprintf($messages[1], $messages[4]), |
|
109 | + sprintf('<a href="%s">%s</a>', admin_url('update-core.php'), $messages[5]) |
|
110 | 110 | ); |
111 | 111 | } |
112 | 112 | } |
@@ -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 Started' ); |
|
112 | - apply_filters( 'debug', 'blackbar/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 Started'); |
|
112 | + apply_filters('debug', 'blackbar/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 string |
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 | } |
@@ -37,19 +37,19 @@ discard block |
||
37 | 37 | * @param array $timer |
38 | 38 | * @return string |
39 | 39 | */ |
40 | - public function getMemoryString( $timer ) |
|
40 | + public function getMemoryString($timer) |
|
41 | 41 | { |
42 | - $timer = $this->normalize( $timer ); |
|
43 | - return sprintf( '%s %s', round( $timer['memory'] / 1000 ), __( 'kB', 'blackbar' )); |
|
42 | + $timer = $this->normalize($timer); |
|
43 | + return sprintf('%s %s', round($timer['memory'] / 1000), __('kB', 'blackbar')); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
47 | 47 | * @param array $timer |
48 | 48 | * @return string |
49 | 49 | */ |
50 | - public function getNameString( $timer ) |
|
50 | + public function getNameString($timer) |
|
51 | 51 | { |
52 | - $timer = $this->normalize( $timer ); |
|
52 | + $timer = $this->normalize($timer); |
|
53 | 53 | return $timer['name']; |
54 | 54 | } |
55 | 55 | |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | * @param array $timer |
58 | 58 | * @return string |
59 | 59 | */ |
60 | - public function getTimeString( $timer ) |
|
60 | + public function getTimeString($timer) |
|
61 | 61 | { |
62 | - $timer = $this->normalize( $timer ); |
|
63 | - $index = array_search( $timer['name'], array_column( $this->timers, 'name' )); |
|
64 | - $start = $this->start + ( $index * $this->noise ); |
|
65 | - $time = number_format( round(( $timer['time'] - $start ) * 1000, 4 ), 4 ); |
|
66 | - return sprintf( '%s %s', $time, __( 'ms', 'blackbar' )); |
|
62 | + $timer = $this->normalize($timer); |
|
63 | + $index = array_search($timer['name'], array_column($this->timers, 'name')); |
|
64 | + $start = $this->start + ($index * $this->noise); |
|
65 | + $time = number_format(round(($timer['time'] - $start) * 1000, 4), 4); |
|
66 | + return sprintf('%s %s', $time, __('ms', 'blackbar')); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -71,20 +71,20 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function getTotalTime() |
73 | 73 | { |
74 | - $totalNoise = ( count( $this->timers ) - 1 ) * $this->noise; |
|
74 | + $totalNoise = (count($this->timers) - 1) * $this->noise; |
|
75 | 75 | return $this->stop - $this->start - $totalNoise; |
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
79 | 79 | * @param string $name |
80 | 80 | */ |
81 | - public function trace( $name ) |
|
81 | + public function trace($name) |
|
82 | 82 | { |
83 | - $microtime = microtime( true ); |
|
84 | - if( !$this->start ) { |
|
83 | + $microtime = microtime(true); |
|
84 | + if (!$this->start) { |
|
85 | 85 | $this->start = $microtime; |
86 | 86 | } |
87 | - if( $name === 'blackbar/profiler/noise' ) { |
|
87 | + if ($name === 'blackbar/profiler/noise') { |
|
88 | 88 | $this->noise = $microtime - $this->start; |
89 | 89 | return; |
90 | 90 | } |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | /** |
100 | 100 | * @return array |
101 | 101 | */ |
102 | - protected function normalize( $timer ) |
|
102 | + protected function normalize($timer) |
|
103 | 103 | { |
104 | - return wp_parse_args( (array) $timer, array( |
|
104 | + return wp_parse_args((array) $timer, array( |
|
105 | 105 | 'name' => '', |
106 | 106 | 'time' => 0, |
107 | 107 | 'memory' => 0, |