| @@ -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> | 
| @@ -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 | } | 
| @@ -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 | } | 
| @@ -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 | |
| @@ -89,7 +89,7 @@ discard block | ||
| 89 | 89 | $this->noise = $microtime - $this->start; | 
| 90 | 90 | return; | 
| 91 | 91 | } | 
| 92 | - $this->timers[] = array( | |
| 92 | + $this->timers[ ] = array( | |
| 93 | 93 | 'memory' => memory_get_peak_usage(), | 
| 94 | 94 | 'name' => $name, | 
| 95 | 95 | 'time' => $microtime, | 
| @@ -103,10 +103,10 @@ discard block | ||
| 103 | 103 | */ | 
| 104 | 104 | protected function normalize( $timer ) | 
| 105 | 105 |  	{ | 
| 106 | - return wp_parse_args( (array)$timer, array( | |
| 106 | + return wp_parse_args( (array) $timer, array( | |
| 107 | 107 | 'memory' => 0, | 
| 108 | 108 | 'name' => '', | 
| 109 | 109 | 'time' => 0, | 
| 110 | - )); | |
| 110 | + ) ); | |
| 111 | 111 | } | 
| 112 | 112 | } | 
| @@ -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( isset( $_SESSION ) ? $_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( isset( $_SESSION ) ? $_SESSION : [ ], true ) ); ?>;</code></pre><br/> | |
| 7 | +<pre><code class="php">$_SERVER = <?= esc_html( var_export( $_SERVER, true ) ); ?>;</code></pre><br/> | |
| @@ -2,15 +2,15 @@ | ||
| 2 | 2 | |
| 3 | 3 | <table> | 
| 4 | 4 | <tbody> | 
| 5 | - <?php if( empty( $entries )) : ?> | |
| 5 | + <?php if( empty( $entries ) ) : ?> | |
| 6 | 6 | <tr> | 
| 7 | 7 | <td><?= __( 'No entries found.', 'blackbar' ); ?></td> | 
| 8 | 8 | </tr> | 
| 9 | 9 | <?php else : ?> | 
| 10 | 10 | <?php foreach( $entries as $entry ) : ?> | 
| 11 | 11 | <tr> | 
| 12 | - <td class="glbb-small"><?= $entry['name']; ?></td> | |
| 13 | - <td><pre><?= $entry['message']; ?></pre></td> | |
| 12 | + <td class="glbb-small"><?= $entry[ 'name' ]; ?></td> | |
| 13 | + <td><pre><?= $entry[ 'message' ]; ?></pre></td> | |
| 14 | 14 | </tr> | 
| 15 | 15 | <?php endforeach; ?> | 
| 16 | 16 | <?php endif; ?> | 
| @@ -6,10 +6,13 @@ | ||
| 6 | 6 | <tr> | 
| 7 | 7 | <td><?= __( 'No entries found.', 'blackbar' ); ?></td> | 
| 8 | 8 | </tr> | 
| 9 | - <?php else : ?> | |
| 9 | +		<?php else { | |
| 10 | + : ?> | |
| 10 | 11 | <?php foreach( $entries as $entry ) : ?> | 
| 11 | 12 | <tr> | 
| 12 | - <td class="glbb-small"><?= $entry['name']; ?></td> | |
| 13 | + <td class="glbb-small"><?= $entry['name']; | |
| 14 | +} | |
| 15 | +?></td> | |
| 13 | 16 | <td><pre><?= $entry['message']; ?></pre></td> | 
| 14 | 17 | </tr> | 
| 15 | 18 | <?php endforeach; ?> | 
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | |
| 3 | 3 | <table> | 
| 4 | 4 | <tbody> | 
| 5 | - <?php if( empty( $profiler->getMeasure() )) : ?> | |
| 5 | + <?php if( empty( $profiler->getMeasure() ) ) : ?> | |
| 6 | 6 | <tr> | 
| 7 | 7 | <td><?= __( 'No entries found.', 'blackbar' ); ?></td> | 
| 8 | 8 | </tr> | 
| @@ -6,10 +6,13 @@ | ||
| 6 | 6 | <tr> | 
| 7 | 7 | <td><?= __( 'No entries found.', 'blackbar' ); ?></td> | 
| 8 | 8 | </tr> | 
| 9 | - <?php else : ?> | |
| 9 | +		<?php else { | |
| 10 | + : ?> | |
| 10 | 11 | <?php foreach( $profiler->getMeasure() as $timer ) : ?> | 
| 11 | 12 | <tr> | 
| 12 | - <td><?= $profiler->getNameString( $timer ); ?></td> | |
| 13 | + <td><?= $profiler->getNameString( $timer ); | |
| 14 | +} | |
| 15 | +?></td> | |
| 13 | 16 | <td class="glbb-medium"><?= $profiler->getTimeString( $timer ); ?></td> | 
| 14 | 17 | <td class="glbb-medium"><?= $profiler->getMemoryString( $timer ); ?></td> | 
| 15 | 18 | </tr> | 
| @@ -7,7 +7,7 @@ discard block | ||
| 7 | 7 | * @see https://docs.gravityforms.com/gform_noconflict_scripts/ | 
| 8 | 8 | */ | 
| 9 | 9 |  add_filter( 'gform_noconflict_scripts', function( array $scripts ) { | 
| 10 | - $scripts[] = 'blackbar'; | |
| 10 | + $scripts[ ] = 'blackbar'; | |
| 11 | 11 | return $scripts; | 
| 12 | 12 | }); | 
| 13 | 13 | |
| @@ -16,7 +16,7 @@ discard block | ||
| 16 | 16 | * @see https://docs.gravityforms.com/gform_noconflict_styles/ | 
| 17 | 17 | */ | 
| 18 | 18 |  add_filter( 'gform_noconflict_styles', function( array $styles ) { | 
| 19 | - $styles[] = 'blackbar'; | |
| 20 | - $styles[] = 'blackbar-syntax'; | |
| 19 | + $styles[ ] = 'blackbar'; | |
| 20 | + $styles[ ] = 'blackbar-syntax'; | |
| 21 | 21 | return $styles; | 
| 22 | 22 | }); | 
| @@ -6,7 +6,8 @@ discard block | ||
| 6 | 6 | * @return array | 
| 7 | 7 | * @see https://docs.gravityforms.com/gform_noconflict_scripts/ | 
| 8 | 8 | */ | 
| 9 | -add_filter( 'gform_noconflict_scripts', function( array $scripts ) { | |
| 9 | +add_filter( 'gform_noconflict_scripts', function( array $scripts ) | |
| 10 | +{ | |
| 10 | 11 | $scripts[] = 'blackbar'; | 
| 11 | 12 | return $scripts; | 
| 12 | 13 | }); | 
| @@ -15,7 +16,8 @@ discard block | ||
| 15 | 16 | * @return array | 
| 16 | 17 | * @see https://docs.gravityforms.com/gform_noconflict_styles/ | 
| 17 | 18 | */ | 
| 18 | -add_filter( 'gform_noconflict_styles', function( array $styles ) { | |
| 19 | +add_filter( 'gform_noconflict_styles', function( array $styles ) | |
| 20 | +{ | |
| 19 | 21 | $styles[] = 'blackbar'; | 
| 20 | 22 | $styles[] = 'blackbar-syntax'; | 
| 21 | 23 | return $styles; | 
| @@ -30,7 +30,7 @@ discard block | ||
| 30 | 30 | $this->versions = wp_parse_args( $versions, array( | 
| 31 | 31 | 'php' => static::MIN_PHP_VERSION, | 
| 32 | 32 | 'wordpress' => static::MIN_WORDPRESS_VERSION, | 
| 33 | - )); | |
| 33 | + ) ); | |
| 34 | 34 | } | 
| 35 | 35 | |
| 36 | 36 | /** | 
| @@ -41,8 +41,8 @@ discard block | ||
| 41 | 41 |  		if( $this->isValid() ) { | 
| 42 | 42 | return true; | 
| 43 | 43 | } | 
| 44 | - add_action( 'activated_plugin', array( $this, 'deactivate' )); | |
| 45 | - add_action( 'admin_notices', array( $this, 'deactivate' )); | |
| 44 | + add_action( 'activated_plugin', array( $this, 'deactivate' ) ); | |
| 45 | + add_action( 'admin_notices', array( $this, 'deactivate' ) ); | |
| 46 | 46 | return false; | 
| 47 | 47 | } | 
| 48 | 48 | |
| @@ -51,7 +51,7 @@ discard block | ||
| 51 | 51 | */ | 
| 52 | 52 | public function isPhpValid() | 
| 53 | 53 |  	{ | 
| 54 | - return !version_compare( PHP_VERSION, $this->versions['php'], '<' ); | |
| 54 | + return !version_compare( PHP_VERSION, $this->versions[ 'php' ], '<' ); | |
| 55 | 55 | } | 
| 56 | 56 | |
| 57 | 57 | /** | 
| @@ -68,7 +68,7 @@ discard block | ||
| 68 | 68 | public function isWpValid() | 
| 69 | 69 |  	{ | 
| 70 | 70 | global $wp_version; | 
| 71 | - return !version_compare( $wp_version, $this->versions['wordpress'], '<' ); | |
| 71 | + return !version_compare( $wp_version, $this->versions[ 'wordpress' ], '<' ); | |
| 72 | 72 | } | 
| 73 | 73 | |
| 74 | 74 | /** | 
| @@ -84,7 +84,7 @@ discard block | ||
| 84 | 84 | } | 
| 85 | 85 | $pluginData = get_file_data( $this->file, array( 'name' => 'Plugin Name' ), 'plugin' ); | 
| 86 | 86 | deactivate_plugins( $pluginSlug ); | 
| 87 | - $this->printNotice( $pluginData['name'] ); | |
| 87 | + $this->printNotice( $pluginData[ 'name' ] ); | |
| 88 | 88 | } | 
| 89 | 89 | |
| 90 | 90 | /** | 
| @@ -111,19 +111,19 @@ discard block | ||
| 111 | 111 |  	{ | 
| 112 | 112 | $noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>'; | 
| 113 | 113 | $messages = $this->getMessages(); | 
| 114 | - $rollbackMessage = sprintf( '<strong>'.$messages[6].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/">WP Rollback</a>', $pluginName ); | |
| 114 | + $rollbackMessage = sprintf( '<strong>' . $messages[ 6 ] . '</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/">WP Rollback</a>', $pluginName ); | |
| 115 | 115 |  		if( !$this->isPhpValid() ) { | 
| 116 | 116 | printf( $noticeTemplate, | 
| 117 | - sprintf( $messages[0], $pluginName ), | |
| 118 | - sprintf( $messages[1], $messages[3].' '.$this->versions['php'] ), | |
| 119 | - sprintf( $messages[2], PHP_VERSION ).'</p><p>'.$rollbackMessage | |
| 117 | + sprintf( $messages[ 0 ], $pluginName ), | |
| 118 | + sprintf( $messages[ 1 ], $messages[ 3 ] . ' ' . $this->versions[ 'php' ] ), | |
| 119 | + sprintf( $messages[ 2 ], PHP_VERSION ) . '</p><p>' . $rollbackMessage | |
| 120 | 120 | ); | 
| 121 | 121 | } | 
| 122 | 122 |  		else if( !$this->isWpValid() ) { | 
| 123 | 123 | printf( $noticeTemplate, | 
| 124 | - sprintf( $messages[0], $pluginName ), | |
| 125 | - sprintf( $messages[1], $messages[4].' '.$this->versions['wordpress'] ), | |
| 126 | - $rollbackMessage.'</p><p>'.sprintf( '<a href="%s">%s</a>', admin_url( 'update-core.php' ), $messages[5] ) | |
| 124 | + sprintf( $messages[ 0 ], $pluginName ), | |
| 125 | + sprintf( $messages[ 1 ], $messages[ 4 ] . ' ' . $this->versions[ 'wordpress' ] ), | |
| 126 | + $rollbackMessage . '</p><p>' . sprintf( '<a href="%s">%s</a>', admin_url( 'update-core.php' ), $messages[ 5 ] ) | |
| 127 | 127 | ); | 
| 128 | 128 | } | 
| 129 | 129 | } | 
| @@ -137,7 +137,7 @@ discard block | ||
| 137 | 137 | filter_input( INPUT_GET, 'plugin_status' ), | 
| 138 | 138 | filter_input( INPUT_GET, 'paged' ), | 
| 139 | 139 | filter_input( INPUT_GET, 's' ) | 
| 140 | - ))); | |
| 140 | + ) ) ); | |
| 141 | 141 | exit; | 
| 142 | 142 | } | 
| 143 | 143 | } | 
| @@ -77,7 +77,9 @@ | ||
| 77 | 77 | */ | 
| 78 | 78 | public function deactivate( $plugin ) | 
| 79 | 79 |  	{ | 
| 80 | - if( $this->isValid() )return; | |
| 80 | +		if( $this->isValid() ) { | |
| 81 | + return; | |
| 82 | + } | |
| 81 | 83 | $pluginSlug = plugin_basename( $this->file ); | 
| 82 | 84 |  		if( $plugin == $pluginSlug ) { | 
| 83 | 85 | $this->redirect(); //exit | 
| @@ -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(); | |
| @@ -21,7 +21,9 @@ | ||
| 21 | 21 |  if( !class_exists( 'GL_Plugin_Check_v3' )) { | 
| 22 | 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; | |
| 24 | +if( !(new GL_Plugin_Check_v3( __FILE__, array( 'php' => '5.6', 'wordpress' => '4.7.0' )))->canProceed() ) { | |
| 25 | + return; | |
| 26 | +} | |
| 25 | 27 | require_once __DIR__.'/autoload.php'; | 
| 26 | 28 | require_once __DIR__.'/compatibility.php'; | 
| 27 | 29 | |