@@ -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/> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public function getMemoryString( $timer ) |
41 | 41 | { |
42 | 42 | $timer = $this->normalize( $timer ); |
43 | - return sprintf( '%s kB', round( $timer['memory'] / 1000 )); |
|
43 | + return sprintf( '%s kB', round( $timer[ 'memory' ] / 1000 ) ); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public function getNameString( $timer ) |
51 | 51 | { |
52 | 52 | $timer = $this->normalize( $timer ); |
53 | - return $timer['name']; |
|
53 | + return $timer[ 'name' ]; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | public function getTimeString( $timer ) |
61 | 61 | { |
62 | 62 | $timer = $this->normalize( $timer ); |
63 | - $index = array_search( $timer['name'], array_column( $this->timers, 'name' )); |
|
63 | + $index = array_search( $timer[ 'name' ], array_column( $this->timers, 'name' ) ); |
|
64 | 64 | $start = $this->start + ( $index * $this->noise ); |
65 | - $time = number_format( round(( $timer['time'] - $start ) * 1000, 4 ), 4 ); |
|
65 | + $time = number_format( round( ( $timer[ 'time' ] - $start ) * 1000, 4 ), 4 ); |
|
66 | 66 | return sprintf( '%s ms', $time ); |
67 | 67 | } |
68 | 68 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $this->noise = $microtime - $this->start; |
89 | 89 | return; |
90 | 90 | } |
91 | - $this->timers[] = array( |
|
91 | + $this->timers[ ] = array( |
|
92 | 92 | 'name' => $name, |
93 | 93 | 'time' => $microtime, |
94 | 94 | 'memory' => memory_get_peak_usage(), |
@@ -105,6 +105,6 @@ discard block |
||
105 | 105 | 'name' => '', |
106 | 106 | 'time' => 0, |
107 | 107 | 'memory' => 0, |
108 | - )); |
|
108 | + ) ); |
|
109 | 109 | } |
110 | 110 | } |
@@ -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> |
@@ -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 | /** |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | 8192 => 'Deprecated', |
49 | 49 | ); |
50 | 50 | $errname = array_key_exists( $errno, $errorCodes ) |
51 | - ? $errorCodes[$errno] |
|
51 | + ? $errorCodes[ $errno ] |
|
52 | 52 | : 'Unknown'; |
53 | - $hash = md5( $errno.$errstr.$errfile.$errline ); |
|
54 | - if( array_key_exists( $hash, $this->errors )) { |
|
55 | - $this->errors[$hash]['count']++; |
|
53 | + $hash = md5( $errno . $errstr . $errfile . $errline ); |
|
54 | + if( array_key_exists( $hash, $this->errors ) ) { |
|
55 | + $this->errors[ $hash ][ 'count' ]++; |
|
56 | 56 | } |
57 | 57 | else { |
58 | - $this->errors[$hash] = array( |
|
58 | + $this->errors[ $hash ] = array( |
|
59 | 59 | "errno" => $errno, |
60 | 60 | "message" => $errstr, |
61 | 61 | "file" => $errfile, |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 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 | /** |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function filterNoconflictScripts( $scripts ) |
82 | 82 | { |
83 | - $scripts[] = static::ID; |
|
83 | + $scripts[ ] = static::ID; |
|
84 | 84 | return $scripts; |
85 | 85 | } |
86 | 86 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function filterNoconflictStyles( $styles ) |
91 | 91 | { |
92 | - $styles[] = static::ID; |
|
93 | - $styles[] = static::ID.'-syntax'; |
|
92 | + $styles[ ] = static::ID; |
|
93 | + $styles[ ] = static::ID . '-syntax'; |
|
94 | 94 | return $styles; |
95 | 95 | } |
96 | 96 | |
@@ -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' )); |
|
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 | 111 | apply_filters( 'debug', 'Profiler Started' ); |
112 | 112 | apply_filters( 'debug', 'blackbar/profiler/noise' ); |
113 | - set_error_handler( array( $this, 'errorHandler' ), E_ALL|E_STRICT ); |
|
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 | /** |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | */ |
140 | 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; |
|
142 | + $file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ) ) ); |
|
143 | + if( !file_exists( $file ) )return; |
|
144 | 144 | extract( $data ); |
145 | 145 | include $file; |
146 | 146 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | 'queries' => $this->getQueries(), |
163 | 163 | 'queriesLabel' => $this->getQueriesLabel(), |
164 | 164 | 'templates' => $this->getTemplates(), |
165 | - )); |
|
165 | + ) ); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -180,18 +180,18 @@ discard block |
||
180 | 180 | { |
181 | 181 | $errors = array(); |
182 | 182 | foreach( $this->errors as $error ) { |
183 | - if( $error['errno'] == E_WARNING ) { |
|
184 | - $error['name'] = '<span class="glbb-error">'.$error['name'].'</span>'; |
|
183 | + if( $error[ 'errno' ] == E_WARNING ) { |
|
184 | + $error[ 'name' ] = '<span class="glbb-error">' . $error[ 'name' ] . '</span>'; |
|
185 | 185 | } |
186 | - if( $error['count'] > 1 ) { |
|
187 | - $error['name'] .= ' ('.$error['count'].')'; |
|
186 | + if( $error[ 'count' ] > 1 ) { |
|
187 | + $error[ 'name' ] .= ' (' . $error[ 'count' ] . ')'; |
|
188 | 188 | } |
189 | - $errors[] = array( |
|
190 | - 'name' => $error['name'], |
|
189 | + $errors[ ] = array( |
|
190 | + 'name' => $error[ 'name' ], |
|
191 | 191 | 'message' => sprintf( __( '%s on line %s in file %s', 'blackbar' ), |
192 | - $error['message'], |
|
193 | - $error['line'], |
|
194 | - $error['file'] |
|
192 | + $error[ 'message' ], |
|
193 | + $error[ 'line' ], |
|
194 | + $error[ 'file' ] |
|
195 | 195 | ), |
196 | 196 | ); |
197 | 197 | } |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | { |
206 | 206 | $warningCount = 0; |
207 | 207 | foreach( $this->errors as $error ) { |
208 | - if( $error['errno'] == E_WARNING ) { |
|
208 | + if( $error[ 'errno' ] == E_WARNING ) { |
|
209 | 209 | $warningCount++; |
210 | 210 | } |
211 | 211 | } |
212 | 212 | $errorCount = count( $this->errors ); |
213 | 213 | $warnings = $warningCount > 0 ? sprintf( ', %d!', $warningCount ) : ''; |
214 | - return sprintf( __( 'Errors (%s)', 'blackbar' ), $errorCount.$warnings ); |
|
214 | + return sprintf( __( 'Errors (%s)', 'blackbar' ), $errorCount . $warnings ); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -222,8 +222,8 @@ discard block |
||
222 | 222 | $includes = array_values( array_filter( get_included_files(), function( $include ) { |
223 | 223 | $bool = strpos( $include, '/themes/' ) !== false |
224 | 224 | && strpos( $include, '/functions.php' ) === false; |
225 | - return (bool)apply_filters( 'blackbar/templates/include', $bool, $include ); |
|
226 | - })); |
|
225 | + return (bool) apply_filters( 'blackbar/templates/include', $bool, $include ); |
|
226 | + }) ); |
|
227 | 227 | return array_map( function( $key, $value ) { |
228 | 228 | $value = str_replace( trailingslashit( WP_CONTENT_DIR ), '', $value ); |
229 | 229 | return sprintf( '[%s] => %s', $key, $value ); |
@@ -251,14 +251,14 @@ discard block |
||
251 | 251 | 'ORDER BY', 'SET', 'WHERE', |
252 | 252 | ); |
253 | 253 | $replace = array_map( function( $value ) { |
254 | - return PHP_EOL.$value; |
|
254 | + return PHP_EOL . $value; |
|
255 | 255 | }, $search ); |
256 | 256 | foreach( $wpdb->queries as $query ) { |
257 | - $miliseconds = number_format( round( $query[1] * 1000, 4 ), 4 ); |
|
258 | - $sql = preg_replace( '/\s\s+/', ' ', trim( $query[0] )); |
|
257 | + $miliseconds = number_format( round( $query[ 1 ] * 1000, 4 ), 4 ); |
|
258 | + $sql = preg_replace( '/\s\s+/', ' ', trim( $query[ 0 ] ) ); |
|
259 | 259 | $sql = str_replace( PHP_EOL, ' ', $sql ); |
260 | 260 | $sql = str_replace( $search, $replace, $sql ); |
261 | - $queries[] = array( |
|
261 | + $queries[ ] = array( |
|
262 | 262 | 'ms' => $miliseconds, |
263 | 263 | 'sql' => $sql, |
264 | 264 | ); |
@@ -277,10 +277,10 @@ discard block |
||
277 | 277 | global $wpdb; |
278 | 278 | $queryTime = 0; |
279 | 279 | foreach( $wpdb->queries as $query ) { |
280 | - $queryTime += $query[1]; |
|
280 | + $queryTime += $query[ 1 ]; |
|
281 | 281 | } |
282 | - $queriesCount = '<span class="glbb-queries-count">'.count( $wpdb->queries ).'</span>'; |
|
283 | - $queriesTime = '<span class="glbb-queries-time">'.$this->convertToMiliseconds( $queryTime ).'</span>'; |
|
282 | + $queriesCount = '<span class="glbb-queries-count">' . count( $wpdb->queries ) . '</span>'; |
|
283 | + $queriesTime = '<span class="glbb-queries-time">' . $this->convertToMiliseconds( $queryTime ) . '</span>'; |
|
284 | 284 | return sprintf( __( 'SQL (%s queries in %s ms)', 'blackbar' ), $queriesCount, $queriesTime ); |
285 | 285 | } |
286 | 286 | |
@@ -290,12 +290,12 @@ discard block |
||
290 | 290 | protected function getTemplates() |
291 | 291 | { |
292 | 292 | if( is_admin() )return; |
293 | - if( class_exists( '\GeminiLabs\Castor\Facades\Development' )) { |
|
293 | + if( class_exists( '\GeminiLabs\Castor\Facades\Development' ) ) { |
|
294 | 294 | ob_start(); |
295 | 295 | \GeminiLabs\Castor\Facades\Development::printTemplatePaths(); |
296 | 296 | return ob_get_clean(); |
297 | 297 | } |
298 | - return '<pre>'.implode( PHP_EOL, $this->getIncludedFiles() ).'</pre>'; |
|
298 | + return '<pre>' . implode( PHP_EOL, $this->getIncludedFiles() ) . '</pre>'; |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | */ |
305 | 305 | protected function path( $file = '' ) |
306 | 306 | { |
307 | - return plugin_dir_path( $this->file ).ltrim( trim( $file ), '/' ); |
|
307 | + return plugin_dir_path( $this->file ) . ltrim( trim( $file ), '/' ); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -313,6 +313,6 @@ discard block |
||
313 | 313 | */ |
314 | 314 | protected function url( $path = '' ) |
315 | 315 | { |
316 | - return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' )); |
|
316 | + return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ) ); |
|
317 | 317 | } |
318 | 318 | } |
@@ -119,7 +119,9 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function initProfiler() |
121 | 121 | { |
122 | - if( func_get_arg(0) != static::DEBUG )return; |
|
122 | + if( func_get_arg(0) != static::DEBUG ) { |
|
123 | + return; |
|
124 | + } |
|
123 | 125 | $this->profiler->trace( func_get_arg(1) ); |
124 | 126 | } |
125 | 127 | |
@@ -140,7 +142,9 @@ discard block |
||
140 | 142 | public function render( $view, array $data = array() ) |
141 | 143 | { |
142 | 144 | $file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ))); |
143 | - if( !file_exists( $file ))return; |
|
145 | + if( !file_exists( $file )) { |
|
146 | + return; |
|
147 | + } |
|
144 | 148 | extract( $data ); |
145 | 149 | include $file; |
146 | 150 | } |
@@ -219,12 +223,14 @@ discard block |
||
219 | 223 | */ |
220 | 224 | protected function getIncludedFiles() |
221 | 225 | { |
222 | - $includes = array_values( array_filter( get_included_files(), function( $include ) { |
|
226 | + $includes = array_values( array_filter( get_included_files(), function( $include ) |
|
227 | + { |
|
223 | 228 | $bool = strpos( $include, '/themes/' ) !== false |
224 | 229 | && strpos( $include, '/functions.php' ) === false; |
225 | 230 | return (bool)apply_filters( 'blackbar/templates/include', $bool, $include ); |
226 | 231 | })); |
227 | - return array_map( function( $key, $value ) { |
|
232 | + return array_map( function( $key, $value ) |
|
233 | + { |
|
228 | 234 | $value = str_replace( trailingslashit( WP_CONTENT_DIR ), '', $value ); |
229 | 235 | return sprintf( '[%s] => %s', $key, $value ); |
230 | 236 | }, array_keys( $includes ), $includes ); |
@@ -250,7 +256,8 @@ discard block |
||
250 | 256 | 'AND', 'FROM', 'GROUP BY', 'INNER JOIN', 'LIMIT', 'ON DUPLICATE KEY UPDATE', |
251 | 257 | 'ORDER BY', 'SET', 'WHERE', |
252 | 258 | ); |
253 | - $replace = array_map( function( $value ) { |
|
259 | + $replace = array_map( function( $value ) |
|
260 | + { |
|
254 | 261 | return PHP_EOL.$value; |
255 | 262 | }, $search ); |
256 | 263 | foreach( $wpdb->queries as $query ) { |
@@ -289,7 +296,9 @@ discard block |
||
289 | 296 | */ |
290 | 297 | protected function getTemplates() |
291 | 298 | { |
292 | - if( is_admin() )return; |
|
299 | + if( is_admin() ) { |
|
300 | + return; |
|
301 | + } |
|
293 | 302 | if( class_exists( '\GeminiLabs\Castor\Facades\Development' )) { |
294 | 303 | ob_start(); |
295 | 304 | \GeminiLabs\Castor\Facades\Development::printTemplatePaths(); |