@@ -30,37 +30,37 @@ discard block |
||
30 | 30 | |
31 | 31 | public function classes(): string |
32 | 32 | { |
33 | - $errno = array_unique(wp_list_pluck($this->entries, 'errno')); |
|
34 | - if (in_array(E_ERROR, $errno)) { |
|
35 | - return sprintf('%s glbb-error', $this->id()); |
|
33 | + $errno = array_unique( wp_list_pluck( $this->entries, 'errno' ) ); |
|
34 | + if( in_array( E_ERROR, $errno ) ) { |
|
35 | + return sprintf( '%s glbb-error', $this->id() ); |
|
36 | 36 | } |
37 | - if (in_array(E_WARNING, $errno)) { |
|
38 | - return sprintf('%s glbb-warning', $this->id()); |
|
37 | + if( in_array( E_WARNING, $errno ) ) { |
|
38 | + return sprintf( '%s glbb-warning', $this->id() ); |
|
39 | 39 | } |
40 | 40 | return $this->id(); |
41 | 41 | } |
42 | 42 | |
43 | 43 | public function entries(): array |
44 | 44 | { |
45 | - $entries = []; |
|
46 | - foreach ($this->entries as $entry) { |
|
47 | - $entry['name'] = ucfirst($entry['errname']); |
|
48 | - if ($entry['count'] > 1) { |
|
49 | - $entry['name'] = sprintf('%s (%s)', $entry['name'], $entry['count']); |
|
45 | + $entries = [ ]; |
|
46 | + foreach( $this->entries as $entry ) { |
|
47 | + $entry[ 'name' ] = ucfirst( $entry[ 'errname' ] ); |
|
48 | + if( $entry[ 'count' ] > 1 ) { |
|
49 | + $entry[ 'name' ] = sprintf( '%s (%s)', $entry[ 'name' ], $entry[ 'count' ] ); |
|
50 | 50 | } |
51 | - $entries[] = $entry; |
|
51 | + $entries[ ] = $entry; |
|
52 | 52 | } |
53 | 53 | return $entries; |
54 | 54 | } |
55 | 55 | |
56 | 56 | public function info(): string |
57 | 57 | { |
58 | - $counts = array_count_values(wp_list_pluck($this->entries, 'errno')); |
|
59 | - $entryCount = count($this->entries); |
|
60 | - if (!empty($counts[E_ERROR])) { |
|
61 | - return sprintf('%d, %d!', $entryCount, $counts[E_ERROR]); |
|
58 | + $counts = array_count_values( wp_list_pluck( $this->entries, 'errno' ) ); |
|
59 | + $entryCount = count( $this->entries ); |
|
60 | + if( !empty( $counts[ E_ERROR ] ) ) { |
|
61 | + return sprintf( '%d, %d!', $entryCount, $counts[ E_ERROR ] ); |
|
62 | 62 | } |
63 | - if ($entryCount > 0) { |
|
63 | + if( $entryCount > 0 ) { |
|
64 | 64 | return (string) $entryCount; |
65 | 65 | } |
66 | 66 | return ''; |
@@ -68,51 +68,51 @@ discard block |
||
68 | 68 | |
69 | 69 | public function label(): string |
70 | 70 | { |
71 | - return __('Console', 'blackbar'); |
|
71 | + return __( 'Console', 'blackbar' ); |
|
72 | 72 | } |
73 | 73 | |
74 | - public function store(string $message, string $errno = '', string $location = ''): void |
|
74 | + public function store( string $message, string $errno = '', string $location = '' ): void |
|
75 | 75 | { |
76 | - if (is_numeric($errno)) { // entry likely stored by set_error_handler() |
|
76 | + if( is_numeric( $errno ) ) { // entry likely stored by set_error_handler() |
|
77 | 77 | $errname = 'Unknown'; |
78 | - if (array_key_exists((int) $errno, static::ERROR_CODES)) { |
|
79 | - $errname = static::ERROR_CODES[$errno]; |
|
78 | + if( array_key_exists( (int) $errno, static::ERROR_CODES ) ) { |
|
79 | + $errname = static::ERROR_CODES[ $errno ]; |
|
80 | 80 | } |
81 | 81 | } else { // entry likely stored by filter hook |
82 | 82 | $errname = 'Debug'; |
83 | - if (array_key_exists($errno, static::MAPPED_ERROR_CODES)) { |
|
83 | + if( array_key_exists( $errno, static::MAPPED_ERROR_CODES ) ) { |
|
84 | 84 | $errname = $errno; |
85 | - $errno = static::MAPPED_ERROR_CODES[$errno]; |
|
85 | + $errno = static::MAPPED_ERROR_CODES[ $errno ]; |
|
86 | 86 | } |
87 | 87 | } |
88 | - $errname = strtolower($errname); |
|
89 | - $hash = md5($errno.$errname.$message.$location); |
|
90 | - if (array_key_exists($hash, $this->entries)) { |
|
91 | - ++$this->entries[$hash]['count']; |
|
88 | + $errname = strtolower( $errname ); |
|
89 | + $hash = md5( $errno . $errname . $message . $location ); |
|
90 | + if( array_key_exists( $hash, $this->entries ) ) { |
|
91 | + ++$this->entries[ $hash ][ 'count' ]; |
|
92 | 92 | } else { |
93 | - $this->entries[$hash] = [ |
|
93 | + $this->entries[ $hash ] = [ |
|
94 | 94 | 'count' => 0, |
95 | 95 | 'errname' => $errname, |
96 | 96 | 'errno' => (int) $errno, |
97 | - 'message' => $this->normalizeMessage($message, $location), |
|
97 | + 'message' => $this->normalizeMessage( $message, $location ), |
|
98 | 98 | ]; |
99 | 99 | }; |
100 | 100 | } |
101 | 101 | |
102 | - protected function normalizeMessage($message, string $location): string |
|
102 | + protected function normalizeMessage( $message, string $location ): string |
|
103 | 103 | { |
104 | - if ($message instanceof \DateTime) { |
|
105 | - $message = $message->format('Y-m-d H:i:s'); |
|
106 | - } elseif (is_object($message) || is_array($message)) { |
|
107 | - $message = (new Dump())->dump($message); |
|
104 | + if( $message instanceof \DateTime ) { |
|
105 | + $message = $message->format( 'Y-m-d H:i:s' ); |
|
106 | + } elseif( is_object( $message ) || is_array( $message ) ) { |
|
107 | + $message = ( new Dump() )->dump( $message ); |
|
108 | 108 | } else { |
109 | - $message = esc_html(trim((string) $message)); |
|
109 | + $message = esc_html( trim( (string) $message ) ); |
|
110 | 110 | } |
111 | - $location = trim($location); |
|
112 | - if (!empty($location)) { |
|
113 | - $location = str_replace([WP_CONTENT_DIR, ABSPATH], '', $location); |
|
114 | - $location = sprintf('[%s]', $location); |
|
111 | + $location = trim( $location ); |
|
112 | + if( !empty( $location ) ) { |
|
113 | + $location = str_replace( [ WP_CONTENT_DIR, ABSPATH ], '', $location ); |
|
114 | + $location = sprintf( '[%s]', $location ); |
|
115 | 115 | } |
116 | - return trim(sprintf('%s %s', $location, $message)); |
|
116 | + return trim( sprintf( '%s %s', $location, $message ) ); |
|
117 | 117 | } |
118 | 118 | } |
@@ -9,70 +9,70 @@ |
||
9 | 9 | public function entries(): array |
10 | 10 | { |
11 | 11 | global $wpdb; |
12 | - $entries = []; |
|
12 | + $entries = [ ]; |
|
13 | 13 | $index = 0; |
14 | 14 | $search = [ |
15 | 15 | 'FROM', 'GROUP BY', 'INNER JOIN', 'LEFT JOIN', 'LIMIT', |
16 | 16 | 'ON DUPLICATE KEY UPDATE', 'ORDER BY', 'OFFSET', ' SET', 'WHERE', |
17 | 17 | ]; |
18 | - $replace = array_map(function ($value) { |
|
19 | - return PHP_EOL.$value; |
|
20 | - }, $search); |
|
21 | - foreach ($wpdb->queries as $query) { |
|
22 | - $sql = preg_replace('/\s\s+/', ' ', trim($query[0])); |
|
23 | - $sql = str_replace(PHP_EOL, ' ', $sql); |
|
24 | - $sql = str_replace(['( ',' )',' ,'], ['(',')',','], $sql); |
|
25 | - $sql = str_replace($search, $replace, $sql); |
|
26 | - $parts = explode(PHP_EOL, $sql); |
|
27 | - $sql = array_reduce($parts, function ($carry, $part) { |
|
28 | - if (str_starts_with($part, 'SELECT') && strlen($part) > 100) { |
|
29 | - $part = preg_replace('/\s*(,)\s*/', ','.PHP_EOL.' ', $part); |
|
18 | + $replace = array_map( function( $value ) { |
|
19 | + return PHP_EOL . $value; |
|
20 | + }, $search ); |
|
21 | + foreach( $wpdb->queries as $query ) { |
|
22 | + $sql = preg_replace( '/\s\s+/', ' ', trim( $query[ 0 ] ) ); |
|
23 | + $sql = str_replace( PHP_EOL, ' ', $sql ); |
|
24 | + $sql = str_replace( [ '( ', ' )', ' ,' ], [ '(', ')', ',' ], $sql ); |
|
25 | + $sql = str_replace( $search, $replace, $sql ); |
|
26 | + $parts = explode( PHP_EOL, $sql ); |
|
27 | + $sql = array_reduce( $parts, function( $carry, $part ) { |
|
28 | + if( str_starts_with( $part, 'SELECT' ) && strlen( $part ) > 100 ) { |
|
29 | + $part = preg_replace( '/\s*(,)\s*/', ',' . PHP_EOL . ' ', $part ); |
|
30 | 30 | } |
31 | - if (str_starts_with($part, 'WHERE')) { |
|
32 | - $part = str_replace('AND', PHP_EOL.' AND', $part); |
|
31 | + if( str_starts_with( $part, 'WHERE' ) ) { |
|
32 | + $part = str_replace( 'AND', PHP_EOL . ' AND', $part ); |
|
33 | 33 | } |
34 | - return $carry.$part.PHP_EOL; |
|
34 | + return $carry . $part . PHP_EOL; |
|
35 | 35 | }); |
36 | - $trace = explode(', ', $query[2]); |
|
37 | - $nanoseconds = (int) round($query[1] * 1e9); |
|
38 | - $entries[] = [ |
|
36 | + $trace = explode( ', ', $query[ 2 ] ); |
|
37 | + $nanoseconds = (int) round( $query[ 1 ] * 1e9 ); |
|
38 | + $entries[ ] = [ |
|
39 | 39 | 'index' => $index++, |
40 | 40 | 'sql' => $sql, |
41 | 41 | 'time' => $nanoseconds, |
42 | - 'time_formatted' => $this->formatTime($nanoseconds), |
|
43 | - 'trace' => array_reverse($trace, true), |
|
42 | + 'time_formatted' => $this->formatTime( $nanoseconds ), |
|
43 | + 'trace' => array_reverse( $trace, true ), |
|
44 | 44 | ]; |
45 | 45 | } |
46 | - uasort($entries, [$this, 'sortByTime']); |
|
46 | + uasort( $entries, [ $this, 'sortByTime' ] ); |
|
47 | 47 | return $entries; |
48 | 48 | } |
49 | 49 | |
50 | 50 | public function hasEntries(): bool |
51 | 51 | { |
52 | 52 | global $wpdb; |
53 | - return !empty($wpdb->queries); |
|
53 | + return !empty( $wpdb->queries ); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | public function info(): string |
57 | 57 | { |
58 | - if (!defined('SAVEQUERIES') || !SAVEQUERIES) { |
|
58 | + if( !defined( 'SAVEQUERIES' ) || !SAVEQUERIES ) { |
|
59 | 59 | return ''; |
60 | 60 | } |
61 | 61 | global $wpdb; |
62 | - $seconds = (float) array_sum(wp_list_pluck($wpdb->queries, 1)); |
|
63 | - $nanoseconds = (int) round($seconds * 1e9); |
|
64 | - return $this->formatTime($nanoseconds); |
|
62 | + $seconds = (float) array_sum( wp_list_pluck( $wpdb->queries, 1 ) ); |
|
63 | + $nanoseconds = (int) round( $seconds * 1e9 ); |
|
64 | + return $this->formatTime( $nanoseconds ); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | public function label(): string |
68 | 68 | { |
69 | - return __('SQL', 'blackbar'); |
|
69 | + return __( 'SQL', 'blackbar' ); |
|
70 | 70 | } |
71 | 71 | |
72 | - protected function sortByTime(array $a, array $b): int |
|
72 | + protected function sortByTime( array $a, array $b ): int |
|
73 | 73 | { |
74 | - if ($a['time'] !== $b['time']) { |
|
75 | - return ($a['time'] > $b['time']) ? -1 : 1; |
|
74 | + if( $a[ 'time' ] !== $b[ 'time' ] ) { |
|
75 | + return ( $a[ 'time' ] > $b[ 'time' ] ) ? -1 : 1; |
|
76 | 76 | } |
77 | 77 | return 0; |
78 | 78 | } |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | */ |
16 | 16 | protected $entries; |
17 | 17 | |
18 | - public function __construct(Application $app) |
|
18 | + public function __construct( Application $app ) |
|
19 | 19 | { |
20 | 20 | $this->app = $app; |
21 | - $this->entries = []; |
|
21 | + $this->entries = [ ]; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | public function classes(): string |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | |
31 | 31 | public function hasEntries(): bool |
32 | 32 | { |
33 | - return !empty($this->entries); |
|
33 | + return !empty( $this->entries ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | public function id(): string |
37 | 37 | { |
38 | - return sprintf('glbb-%s', $this->slug()); |
|
38 | + return sprintf( 'glbb-%s', $this->slug() ); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function info(): string |
@@ -52,33 +52,33 @@ discard block |
||
52 | 52 | |
53 | 53 | public function render(): void |
54 | 54 | { |
55 | - $this->app->render('panels/'.$this->slug(), ['module' => $this]); |
|
55 | + $this->app->render( 'panels/' . $this->slug(), [ 'module' => $this ] ); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | public function slug(): string |
59 | 59 | { |
60 | - return strtolower((new \ReflectionClass($this))->getShortName()); |
|
60 | + return strtolower( ( new \ReflectionClass( $this ) )->getShortName() ); |
|
61 | 61 | } |
62 | 62 | |
63 | - protected function formatTime(int $nanoseconds): string |
|
63 | + protected function formatTime( int $nanoseconds ): string |
|
64 | 64 | { |
65 | - if ($nanoseconds >= 1e9) { |
|
66 | - return sprintf('%s s', $this->toDecimal(round($nanoseconds / 1e9, 2))); |
|
65 | + if( $nanoseconds >= 1e9 ) { |
|
66 | + return sprintf( '%s s', $this->toDecimal( round( $nanoseconds / 1e9, 2 ) ) ); |
|
67 | 67 | } |
68 | - if ($nanoseconds >= 1e6) { |
|
69 | - return sprintf('%s ms', $this->toDecimal(round($nanoseconds / 1e6, 2))); |
|
68 | + if( $nanoseconds >= 1e6 ) { |
|
69 | + return sprintf( '%s ms', $this->toDecimal( round( $nanoseconds / 1e6, 2 ) ) ); |
|
70 | 70 | } |
71 | - if ($nanoseconds >= 1e3) { |
|
72 | - return sprintf('%s µs', round($nanoseconds / 1e3)); |
|
71 | + if( $nanoseconds >= 1e3 ) { |
|
72 | + return sprintf( '%s µs', round( $nanoseconds / 1e3 ) ); |
|
73 | 73 | } |
74 | - return sprintf('%s ns', $nanoseconds); |
|
74 | + return sprintf( '%s ns', $nanoseconds ); |
|
75 | 75 | } |
76 | 76 | |
77 | - protected function toDecimal(float $number): string |
|
77 | + protected function toDecimal( float $number ): string |
|
78 | 78 | { |
79 | 79 | $number = (string) $number; |
80 | - if (false !== strpos($number, '.')) { |
|
81 | - $number = rtrim(rtrim($number, '0'), '.'); |
|
80 | + if( false !== strpos( $number, '.' ) ) { |
|
81 | + $number = rtrim( rtrim( $number, '0' ), '.' ); |
|
82 | 82 | } |
83 | 83 | return $number; |
84 | 84 | } |
@@ -1,32 +1,32 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | -<?php if (!defined('SAVEQUERIES') || !SAVEQUERIES) : ?> |
|
3 | +<?php if( !defined( 'SAVEQUERIES' ) || !SAVEQUERIES ) : ?> |
|
4 | 4 | <table> |
5 | 5 | <tbody> |
6 | 6 | <tr> |
7 | - <td><a href="https://wordpress.org/documentation/article/debugging-in-wordpress/#savequeries" target="_blank">SAVEQUERIES</a> <?= esc_html_x('must be enabled to view SQL queries', 'SAVEQUERIES', 'blackbar'); ?>.</td> |
|
7 | + <td><a href="https://wordpress.org/documentation/article/debugging-in-wordpress/#savequeries" target="_blank">SAVEQUERIES</a> <?= esc_html_x( 'must be enabled to view SQL queries', 'SAVEQUERIES', 'blackbar' ); ?>.</td> |
|
8 | 8 | </tr> |
9 | 9 | </tbody> |
10 | 10 | </table> |
11 | 11 | <?php else : ?> |
12 | 12 | <form> |
13 | - <input type="text" id="glbb_queries_sql" placeholder="<?= esc_attr__('Find SQL containing', 'blackbar'); ?>"> |
|
14 | - <input type="text" id="glbb_queries_min_time" placeholder="<?= esc_attr__('Minimum execution time', 'blackbar'); ?>"> |
|
13 | + <input type="text" id="glbb_queries_sql" placeholder="<?= esc_attr__( 'Find SQL containing', 'blackbar' ); ?>"> |
|
14 | + <input type="text" id="glbb_queries_min_time" placeholder="<?= esc_attr__( 'Minimum execution time', 'blackbar' ); ?>"> |
|
15 | 15 | <select id="glbb_queries_sort_by"> |
16 | - <option value><?= esc_html__('Sort by execution time', 'blackbar'); ?></option> |
|
17 | - <option value="order"><?= esc_html__('Sort by execution order', 'blackbar'); ?></option> |
|
16 | + <option value><?= esc_html__( 'Sort by execution time', 'blackbar' ); ?></option> |
|
17 | + <option value="order"><?= esc_html__( 'Sort by execution order', 'blackbar' ); ?></option> |
|
18 | 18 | </select> |
19 | 19 | </form> |
20 | 20 | <table class="glbb-grid"> |
21 | 21 | <tbody> |
22 | - <?php foreach ($module->entries() as $entry) : ?> |
|
23 | - <tr class="glbb-row-collapsed" data-index="<?= esc_attr($entry['index']); ?>" data-time="<?= esc_attr($entry['time']); ?>"> |
|
24 | - <td data-time="<?= esc_attr($entry['time_formatted']); ?>"><div class="glbb-row-toggle dashicons-before dashicons-arrow-right"><?= esc_html($entry['time_formatted']); ?></div></td> |
|
25 | - <td data-sql><pre><code class="language-sql"><?= esc_html($entry['sql']); ?></code></pre></td> |
|
22 | + <?php foreach( $module->entries() as $entry ) : ?> |
|
23 | + <tr class="glbb-row-collapsed" data-index="<?= esc_attr( $entry[ 'index' ] ); ?>" data-time="<?= esc_attr( $entry[ 'time' ] ); ?>"> |
|
24 | + <td data-time="<?= esc_attr( $entry[ 'time_formatted' ] ); ?>"><div class="glbb-row-toggle dashicons-before dashicons-arrow-right"><?= esc_html( $entry[ 'time_formatted' ] ); ?></div></td> |
|
25 | + <td data-sql><pre><code class="language-sql"><?= esc_html( $entry[ 'sql' ] ); ?></code></pre></td> |
|
26 | 26 | <td class="glbb-row-details"> |
27 | 27 | <ol> |
28 | - <?php foreach ($entry['trace'] as $index => $line) : ?> |
|
29 | - <li value="<?= esc_attr($index + 1); ?>"><?= esc_html($line); ?></li> |
|
28 | + <?php foreach( $entry[ 'trace' ] as $index => $line ) : ?> |
|
29 | + <li value="<?= esc_attr( $index + 1 ); ?>"><?= esc_html( $line ); ?></li> |
|
30 | 30 | <?php endforeach; ?> |
31 | 31 | </ol> |
32 | 32 | </td> |
@@ -1,45 +1,45 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | -<?php if (!$module->hasEntries()) : ?> |
|
3 | +<?php if( !$module->hasEntries() ) : ?> |
|
4 | 4 | <table> |
5 | 5 | <tbody> |
6 | 6 | <tr> |
7 | - <td><?= esc_html__('Please deactivate the Debug Bar Slow Actions plugin.', 'blackbar'); ?></td> |
|
7 | + <td><?= esc_html__( 'Please deactivate the Debug Bar Slow Actions plugin.', 'blackbar' ); ?></td> |
|
8 | 8 | </tr> |
9 | 9 | </tbody> |
10 | 10 | </table> |
11 | 11 | <?php else : ?> |
12 | 12 | <form> |
13 | - <input type="text" id="glbb_hooks_callback" placeholder="<?= esc_attr__('Find callbacks containing', 'blackbar'); ?>"> |
|
14 | - <input type="text" id="glbb_hooks_min_time" placeholder="<?= esc_attr__('Minimum total time', 'blackbar'); ?>"> |
|
13 | + <input type="text" id="glbb_hooks_callback" placeholder="<?= esc_attr__( 'Find callbacks containing', 'blackbar' ); ?>"> |
|
14 | + <input type="text" id="glbb_hooks_min_time" placeholder="<?= esc_attr__( 'Minimum total time', 'blackbar' ); ?>"> |
|
15 | 15 | <select id="glbb_hooks_sort_by"> |
16 | - <option value><?= esc_html__('Sort by total time', 'blackbar'); ?></option> |
|
17 | - <option value="order"><?= esc_html__('Sort by execution order', 'blackbar'); ?></option> |
|
16 | + <option value><?= esc_html__( 'Sort by total time', 'blackbar' ); ?></option> |
|
17 | + <option value="order"><?= esc_html__( 'Sort by execution order', 'blackbar' ); ?></option> |
|
18 | 18 | </select> |
19 | 19 | </form> |
20 | 20 | <table class="glbb-grid"> |
21 | 21 | <thead> |
22 | 22 | <tr> |
23 | - <th><?= esc_html__('Action or Filter (Slowest 50)', 'blackbar'); ?></th> |
|
24 | - <th><?= esc_html__('Callbacks', 'blackbar'); ?></th> |
|
25 | - <th><?= esc_html__('Calls', 'blackbar'); ?></th> |
|
26 | - <th><?= esc_html__('Per Call', 'blackbar'); ?></th> |
|
27 | - <th><?= esc_html__('Total', 'blackbar'); ?></th> |
|
23 | + <th><?= esc_html__( 'Action or Filter (Slowest 50)', 'blackbar' ); ?></th> |
|
24 | + <th><?= esc_html__( 'Callbacks', 'blackbar' ); ?></th> |
|
25 | + <th><?= esc_html__( 'Calls', 'blackbar' ); ?></th> |
|
26 | + <th><?= esc_html__( 'Per Call', 'blackbar' ); ?></th> |
|
27 | + <th><?= esc_html__( 'Total', 'blackbar' ); ?></th> |
|
28 | 28 | </tr> |
29 | 29 | </thead> |
30 | 30 | <tbody> |
31 | - <?php foreach ($module->entries() as $hook => $data) : ?> |
|
32 | - <tr class="glbb-row-collapsed" data-index="<?= esc_attr($data['index']); ?>" data-time="<?= esc_attr($data['total']); ?>"> |
|
33 | - <td><div class="glbb-row-toggle dashicons-before dashicons-arrow-right"><?= esc_html($hook); ?></div></td> |
|
34 | - <td data-callbacks="<?= esc_attr($data['callbacks_count']); ?>"><?= esc_html($data['callbacks_count']); ?></td> |
|
35 | - <td data-calls="<?= esc_attr($data['count']); ?>"><?= esc_html($data['count']); ?></td> |
|
36 | - <td data-percall="<?= esc_attr($data['per_call']); ?>"><?= esc_html($data['per_call']); ?></td> |
|
37 | - <td data-total="<?= esc_attr($data['total']); ?>"><?= esc_html($data['total_formatted']); ?></td> |
|
31 | + <?php foreach( $module->entries() as $hook => $data ) : ?> |
|
32 | + <tr class="glbb-row-collapsed" data-index="<?= esc_attr( $data[ 'index' ] ); ?>" data-time="<?= esc_attr( $data[ 'total' ] ); ?>"> |
|
33 | + <td><div class="glbb-row-toggle dashicons-before dashicons-arrow-right"><?= esc_html( $hook ); ?></div></td> |
|
34 | + <td data-callbacks="<?= esc_attr( $data[ 'callbacks_count' ] ); ?>"><?= esc_html( $data[ 'callbacks_count' ] ); ?></td> |
|
35 | + <td data-calls="<?= esc_attr( $data[ 'count' ] ); ?>"><?= esc_html( $data[ 'count' ] ); ?></td> |
|
36 | + <td data-percall="<?= esc_attr( $data[ 'per_call' ] ); ?>"><?= esc_html( $data[ 'per_call' ] ); ?></td> |
|
37 | + <td data-total="<?= esc_attr( $data[ 'total' ] ); ?>"><?= esc_html( $data[ 'total_formatted' ] ); ?></td> |
|
38 | 38 | <td class="glbb-row-details"> |
39 | 39 | <ol> |
40 | - <?php foreach ($data['callbacks'] as $priority => $callbacks) : ?> |
|
41 | - <?php foreach ($callbacks as $callback) : ?> |
|
42 | - <li value="<?= esc_attr($priority); ?>"><?= esc_html($callback); ?></li> |
|
40 | + <?php foreach( $data[ 'callbacks' ] as $priority => $callbacks ) : ?> |
|
41 | + <?php foreach( $callbacks as $callback ) : ?> |
|
42 | + <li value="<?= esc_attr( $priority ); ?>"><?= esc_html( $callback ); ?></li> |
|
43 | 43 | <?php endforeach; ?> |
44 | 44 | <?php endforeach; ?> |
45 | 45 | </ol> |
@@ -1,14 +1,14 @@ discard block |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <div id="glbb"> |
4 | - <?php foreach ($modules as $module) : /* Ensure that the console entries are loaded last */ ?> |
|
5 | - <?php if (!$module->isVisible() || 'glbb-console' === $module->id()) continue; ?> |
|
4 | + <?php foreach( $modules as $module ) : /* Ensure that the console entries are loaded last */ ?> |
|
5 | + <?php if( !$module->isVisible() || 'glbb-console' === $module->id() ) continue; ?> |
|
6 | 6 | <div id="<?= $module->id(); ?>" class="glbb-panel glbb-hidden"> |
7 | 7 | <?php $module->render(); ?> |
8 | 8 | </div> |
9 | 9 | <?php endforeach; ?> |
10 | - <?php foreach ($modules as $module) : /* Ensure that the console entries are loaded last */ ?> |
|
11 | - <?php if (!$module->isVisible() || 'glbb-console' !== $module->id()) continue; ?> |
|
10 | + <?php foreach( $modules as $module ) : /* Ensure that the console entries are loaded last */ ?> |
|
11 | + <?php if( !$module->isVisible() || 'glbb-console' !== $module->id() ) continue; ?> |
|
12 | 12 | <div id="<?= $module->id(); ?>" class="glbb-panel glbb-hidden"> |
13 | 13 | <?php $module->render(); ?> |
14 | 14 | </div> |
@@ -16,19 +16,19 @@ discard block |
||
16 | 16 | <div class="glbb-panel-links"> |
17 | 17 | <a href="#" class="dashicons-before glbb-toggle"> |
18 | 18 | <span class="screen-reader-text"> |
19 | - <?= esc_html__('Toggle', 'blackbar'); ?> |
|
19 | + <?= esc_html__( 'Toggle', 'blackbar' ); ?> |
|
20 | 20 | </span> |
21 | 21 | </a> |
22 | - <?php foreach ($modules as $module) : ?> |
|
23 | - <?php if (!$module->isVisible()) continue; ?> |
|
24 | - <a href="#" data-panel="<?= esc_attr($module->id()); ?>" data-info="<?= esc_attr($module->info()); ?>" class="dashicons-before <?= $module->classes(); ?>"> |
|
22 | + <?php foreach( $modules as $module ) : ?> |
|
23 | + <?php if( !$module->isVisible() ) continue; ?> |
|
24 | + <a href="#" data-panel="<?= esc_attr( $module->id() ); ?>" data-info="<?= esc_attr( $module->info() ); ?>" class="dashicons-before <?= $module->classes(); ?>"> |
|
25 | 25 | <span><?= $module->label(); ?></span> |
26 | 26 | </a> |
27 | 27 | <?php endforeach; ?> |
28 | 28 | <div> |
29 | 29 | <a href="#" class="dashicons-before glbb-close"> |
30 | 30 | <span class="screen-reader-text"> |
31 | - <?= esc_html__('Close', 'blackbar'); ?> |
|
31 | + <?= esc_html__( 'Close', 'blackbar' ); ?> |
|
32 | 32 | </span> |
33 | 33 | </a> |
34 | 34 | </div> |
@@ -1,19 +1,19 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <table class="glbb-grid"> |
4 | 4 | <thead> |
5 | 5 | <tr> |
6 | - <th><?= esc_html__('Timer Name', 'blackbar'); ?></th> |
|
7 | - <th><?= esc_html__('Memory Used', 'blackbar'); ?></th> |
|
8 | - <th><?= esc_html__('Total Time', 'blackbar'); ?></th> |
|
6 | + <th><?= esc_html__( 'Timer Name', 'blackbar' ); ?></th> |
|
7 | + <th><?= esc_html__( 'Memory Used', 'blackbar' ); ?></th> |
|
8 | + <th><?= esc_html__( 'Total Time', 'blackbar' ); ?></th> |
|
9 | 9 | </tr> |
10 | 10 | </thead> |
11 | 11 | <tbody> |
12 | - <?php foreach ($module->entries() as $entry) : ?> |
|
12 | + <?php foreach( $module->entries() as $entry ) : ?> |
|
13 | 13 | <tr> |
14 | - <td><?= esc_html($entry['name']); ?></td> |
|
15 | - <td><?= (string) size_format($entry['memory'], 2); ?></td> |
|
16 | - <td><?= esc_html($entry['time']); ?></td> |
|
14 | + <td><?= esc_html( $entry[ 'name' ] ); ?></td> |
|
15 | + <td><?= (string) size_format( $entry[ 'memory' ], 2 ); ?></td> |
|
16 | + <td><?= esc_html( $entry[ 'time' ] ); ?></td> |
|
17 | 17 | </tr> |
18 | 18 | <?php endforeach; ?> |
19 | 19 | </tbody> |