@@ -7,8 +7,8 @@ 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'; |
|
| 11 | - return $scripts; |
|
| 10 | + $scripts[] = 'blackbar'; |
|
| 11 | + return $scripts; |
|
| 12 | 12 | }); |
| 13 | 13 | |
| 14 | 14 | /* |
@@ -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'; |
|
| 21 | - return $styles; |
|
| 19 | + $styles[] = 'blackbar'; |
|
| 20 | + $styles[] = 'blackbar-syntax'; |
|
| 21 | + return $styles; |
|
| 22 | 22 | }); |
@@ -3,20 +3,20 @@ |
||
| 3 | 3 | defined('WPINC') || die; |
| 4 | 4 | |
| 5 | 5 | spl_autoload_register(function ($className) { |
| 6 | - $namespaces = [ |
|
| 7 | - 'GeminiLabs\\BlackBar\\' => __DIR__.'/plugin/', |
|
| 8 | - 'GeminiLabs\\BlackBar\\Tests\\' => __DIR__.'/tests/', |
|
| 9 | - ]; |
|
| 10 | - foreach ($namespaces as $prefix => $baseDir) { |
|
| 11 | - $len = strlen($prefix); |
|
| 12 | - if (0 !== strncmp($prefix, $className, $len)) { |
|
| 13 | - continue; |
|
| 14 | - } |
|
| 15 | - $file = $baseDir.str_replace('\\', '/', substr($className, $len)).'.php'; |
|
| 16 | - if (!file_exists($file)) { |
|
| 17 | - continue; |
|
| 18 | - } |
|
| 19 | - require $file; |
|
| 20 | - break; |
|
| 21 | - } |
|
| 6 | + $namespaces = [ |
|
| 7 | + 'GeminiLabs\\BlackBar\\' => __DIR__.'/plugin/', |
|
| 8 | + 'GeminiLabs\\BlackBar\\Tests\\' => __DIR__.'/tests/', |
|
| 9 | + ]; |
|
| 10 | + foreach ($namespaces as $prefix => $baseDir) { |
|
| 11 | + $len = strlen($prefix); |
|
| 12 | + if (0 !== strncmp($prefix, $className, $len)) { |
|
| 13 | + continue; |
|
| 14 | + } |
|
| 15 | + $file = $baseDir.str_replace('\\', '/', substr($className, $len)).'.php'; |
|
| 16 | + if (!file_exists($file)) { |
|
| 17 | + continue; |
|
| 18 | + } |
|
| 19 | + require $file; |
|
| 20 | + break; |
|
| 21 | + } |
|
| 22 | 22 | }); |
@@ -8,141 +8,141 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class GL_Plugin_Check_v6 |
| 10 | 10 | { |
| 11 | - const MIN_PHP_VERSION = '7.2'; |
|
| 12 | - const MIN_WORDPRESS_VERSION = '5.8'; |
|
| 11 | + const MIN_PHP_VERSION = '7.2'; |
|
| 12 | + const MIN_WORDPRESS_VERSION = '5.8'; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * @var array |
|
| 16 | - */ |
|
| 17 | - public $versions; |
|
| 14 | + /** |
|
| 15 | + * @var array |
|
| 16 | + */ |
|
| 17 | + public $versions; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var string |
|
| 21 | - */ |
|
| 22 | - protected $file; |
|
| 19 | + /** |
|
| 20 | + * @var string |
|
| 21 | + */ |
|
| 22 | + protected $file; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @param string $file |
|
| 26 | - */ |
|
| 27 | - public function __construct($file) |
|
| 28 | - { |
|
| 29 | - $this->file = realpath($file); |
|
| 30 | - $versionRequirements = get_file_data($this->file, [ |
|
| 31 | - 'php' => 'Requires PHP', |
|
| 32 | - 'wordpress' => 'Requires at least', |
|
| 33 | - ]); |
|
| 34 | - $this->versions = wp_parse_args(array_filter($versionRequirements), [ |
|
| 35 | - 'php' => static::MIN_PHP_VERSION, |
|
| 36 | - 'wordpress' => static::MIN_WORDPRESS_VERSION, |
|
| 37 | - ]); |
|
| 38 | - } |
|
| 24 | + /** |
|
| 25 | + * @param string $file |
|
| 26 | + */ |
|
| 27 | + public function __construct($file) |
|
| 28 | + { |
|
| 29 | + $this->file = realpath($file); |
|
| 30 | + $versionRequirements = get_file_data($this->file, [ |
|
| 31 | + 'php' => 'Requires PHP', |
|
| 32 | + 'wordpress' => 'Requires at least', |
|
| 33 | + ]); |
|
| 34 | + $this->versions = wp_parse_args(array_filter($versionRequirements), [ |
|
| 35 | + 'php' => static::MIN_PHP_VERSION, |
|
| 36 | + 'wordpress' => static::MIN_WORDPRESS_VERSION, |
|
| 37 | + ]); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @return bool |
|
| 42 | - */ |
|
| 43 | - public function canProceed() |
|
| 44 | - { |
|
| 45 | - if ($this->isValid()) { |
|
| 46 | - return true; |
|
| 47 | - } |
|
| 48 | - add_action('activated_plugin', [$this, 'deactivate']); |
|
| 49 | - add_action('admin_notices', [$this, 'deactivate']); |
|
| 50 | - return false; |
|
| 51 | - } |
|
| 40 | + /** |
|
| 41 | + * @return bool |
|
| 42 | + */ |
|
| 43 | + public function canProceed() |
|
| 44 | + { |
|
| 45 | + if ($this->isValid()) { |
|
| 46 | + return true; |
|
| 47 | + } |
|
| 48 | + add_action('activated_plugin', [$this, 'deactivate']); |
|
| 49 | + add_action('admin_notices', [$this, 'deactivate']); |
|
| 50 | + return false; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * @return bool |
|
| 55 | - */ |
|
| 56 | - public function isPhpValid() |
|
| 57 | - { |
|
| 58 | - return version_compare(PHP_VERSION, $this->versions['php'], '>='); |
|
| 59 | - } |
|
| 53 | + /** |
|
| 54 | + * @return bool |
|
| 55 | + */ |
|
| 56 | + public function isPhpValid() |
|
| 57 | + { |
|
| 58 | + return version_compare(PHP_VERSION, $this->versions['php'], '>='); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @return bool |
|
| 63 | - */ |
|
| 64 | - public function isValid() |
|
| 65 | - { |
|
| 66 | - return $this->isPhpValid() && $this->isWpValid(); |
|
| 67 | - } |
|
| 61 | + /** |
|
| 62 | + * @return bool |
|
| 63 | + */ |
|
| 64 | + public function isValid() |
|
| 65 | + { |
|
| 66 | + return $this->isPhpValid() && $this->isWpValid(); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * @return bool |
|
| 71 | - */ |
|
| 72 | - public function isWpValid() |
|
| 73 | - { |
|
| 74 | - global $wp_version; |
|
| 75 | - return version_compare($wp_version, $this->versions['wordpress'], '>='); |
|
| 76 | - } |
|
| 69 | + /** |
|
| 70 | + * @return bool |
|
| 71 | + */ |
|
| 72 | + public function isWpValid() |
|
| 73 | + { |
|
| 74 | + global $wp_version; |
|
| 75 | + return version_compare($wp_version, $this->versions['wordpress'], '>='); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * @param string $plugin |
|
| 80 | - * @return void |
|
| 81 | - */ |
|
| 82 | - public function deactivate($plugin) |
|
| 83 | - { |
|
| 84 | - if ($this->isValid()) { |
|
| 85 | - return; |
|
| 86 | - } |
|
| 87 | - $pluginSlug = plugin_basename($this->file); |
|
| 88 | - if ($plugin == $pluginSlug) { |
|
| 89 | - $this->redirect(); // exit |
|
| 90 | - } |
|
| 91 | - $pluginData = get_file_data($this->file, ['name' => 'Plugin Name'], 'plugin'); |
|
| 92 | - deactivate_plugins($pluginSlug); |
|
| 93 | - $this->printNotice($pluginData['name']); |
|
| 94 | - } |
|
| 78 | + /** |
|
| 79 | + * @param string $plugin |
|
| 80 | + * @return void |
|
| 81 | + */ |
|
| 82 | + public function deactivate($plugin) |
|
| 83 | + { |
|
| 84 | + if ($this->isValid()) { |
|
| 85 | + return; |
|
| 86 | + } |
|
| 87 | + $pluginSlug = plugin_basename($this->file); |
|
| 88 | + if ($plugin == $pluginSlug) { |
|
| 89 | + $this->redirect(); // exit |
|
| 90 | + } |
|
| 91 | + $pluginData = get_file_data($this->file, ['name' => 'Plugin Name'], 'plugin'); |
|
| 92 | + deactivate_plugins($pluginSlug); |
|
| 93 | + $this->printNotice($pluginData['name']); |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * @return array |
|
| 98 | - */ |
|
| 99 | - protected function getMessages() |
|
| 100 | - { |
|
| 101 | - return [ |
|
| 102 | - 'notice' => _x('The %s plugin was deactivated.', 'admin-text', 'blackbar'), |
|
| 103 | - 'php_version' => _x('PHP version', 'admin-text', 'blackbar'), |
|
| 104 | - 'rollback' => _x('You can use the %s plugin to restore %s to the previous version.', 'admin-text', 'blackbar'), |
|
| 105 | - 'update_php' => _x('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.', 'admin-text', 'blackbar'), |
|
| 106 | - 'update_wp' => _x('Update WordPress', 'admin-text', 'blackbar'), |
|
| 107 | - 'wp_version' => _x('WordPress version', 'admin-text', 'blackbar'), |
|
| 108 | - 'wrong_version' => _x('This plugin requires %s or greater in order to work properly.', 'admin-text', 'blackbar'), |
|
| 109 | - ]; |
|
| 110 | - } |
|
| 96 | + /** |
|
| 97 | + * @return array |
|
| 98 | + */ |
|
| 99 | + protected function getMessages() |
|
| 100 | + { |
|
| 101 | + return [ |
|
| 102 | + 'notice' => _x('The %s plugin was deactivated.', 'admin-text', 'blackbar'), |
|
| 103 | + 'php_version' => _x('PHP version', 'admin-text', 'blackbar'), |
|
| 104 | + 'rollback' => _x('You can use the %s plugin to restore %s to the previous version.', 'admin-text', 'blackbar'), |
|
| 105 | + 'update_php' => _x('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.', 'admin-text', 'blackbar'), |
|
| 106 | + 'update_wp' => _x('Update WordPress', 'admin-text', 'blackbar'), |
|
| 107 | + 'wp_version' => _x('WordPress version', 'admin-text', 'blackbar'), |
|
| 108 | + 'wrong_version' => _x('This plugin requires %s or greater in order to work properly.', 'admin-text', 'blackbar'), |
|
| 109 | + ]; |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * @param string $pluginName |
|
| 114 | - * @return void |
|
| 115 | - */ |
|
| 116 | - protected function printNotice($pluginName) |
|
| 117 | - { |
|
| 118 | - $noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>'; |
|
| 119 | - $messages = $this->getMessages(); |
|
| 120 | - $rollbackMessage = sprintf('<strong>'.$messages['rollback'].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/" target="_blank">WP Rollback</a>', $pluginName); |
|
| 121 | - if (!$this->isPhpValid()) { |
|
| 122 | - printf($noticeTemplate, |
|
| 123 | - sprintf($messages['notice'], $pluginName), |
|
| 124 | - sprintf($messages['wrong_version'], $messages['php_version'].' '.$this->versions['php']), |
|
| 125 | - sprintf($messages['update_php'], PHP_VERSION).'</p><p>'.$rollbackMessage |
|
| 126 | - ); |
|
| 127 | - } elseif (!$this->isWpValid()) { |
|
| 128 | - printf($noticeTemplate, |
|
| 129 | - sprintf($messages['notice'], $pluginName), |
|
| 130 | - sprintf($messages['wrong_version'], $messages['wp_version'].' '.$this->versions['wordpress']), |
|
| 131 | - $rollbackMessage.'</p><p>'.sprintf('<a href="%s">%s</a>', admin_url('update-core.php'), $messages['update_wp']) |
|
| 132 | - ); |
|
| 133 | - } |
|
| 134 | - } |
|
| 112 | + /** |
|
| 113 | + * @param string $pluginName |
|
| 114 | + * @return void |
|
| 115 | + */ |
|
| 116 | + protected function printNotice($pluginName) |
|
| 117 | + { |
|
| 118 | + $noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>'; |
|
| 119 | + $messages = $this->getMessages(); |
|
| 120 | + $rollbackMessage = sprintf('<strong>'.$messages['rollback'].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/" target="_blank">WP Rollback</a>', $pluginName); |
|
| 121 | + if (!$this->isPhpValid()) { |
|
| 122 | + printf($noticeTemplate, |
|
| 123 | + sprintf($messages['notice'], $pluginName), |
|
| 124 | + sprintf($messages['wrong_version'], $messages['php_version'].' '.$this->versions['php']), |
|
| 125 | + sprintf($messages['update_php'], PHP_VERSION).'</p><p>'.$rollbackMessage |
|
| 126 | + ); |
|
| 127 | + } elseif (!$this->isWpValid()) { |
|
| 128 | + printf($noticeTemplate, |
|
| 129 | + sprintf($messages['notice'], $pluginName), |
|
| 130 | + sprintf($messages['wrong_version'], $messages['wp_version'].' '.$this->versions['wordpress']), |
|
| 131 | + $rollbackMessage.'</p><p>'.sprintf('<a href="%s">%s</a>', admin_url('update-core.php'), $messages['update_wp']) |
|
| 132 | + ); |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - /** |
|
| 137 | - * @return void |
|
| 138 | - */ |
|
| 139 | - protected function redirect() |
|
| 140 | - { |
|
| 141 | - wp_safe_redirect(self_admin_url(sprintf('plugins.php?plugin_status=%s&paged=%s&s=%s', |
|
| 142 | - filter_input(INPUT_GET, 'plugin_status'), |
|
| 143 | - filter_input(INPUT_GET, 'paged'), |
|
| 144 | - filter_input(INPUT_GET, 's') |
|
| 145 | - ))); |
|
| 146 | - exit; |
|
| 147 | - } |
|
| 136 | + /** |
|
| 137 | + * @return void |
|
| 138 | + */ |
|
| 139 | + protected function redirect() |
|
| 140 | + { |
|
| 141 | + wp_safe_redirect(self_admin_url(sprintf('plugins.php?plugin_status=%s&paged=%s&s=%s', |
|
| 142 | + filter_input(INPUT_GET, 'plugin_status'), |
|
| 143 | + filter_input(INPUT_GET, 'paged'), |
|
| 144 | + filter_input(INPUT_GET, 's') |
|
| 145 | + ))); |
|
| 146 | + exit; |
|
| 147 | + } |
|
| 148 | 148 | } |
@@ -20,13 +20,13 @@ |
||
| 20 | 20 | defined('ABSPATH') || exit; |
| 21 | 21 | |
| 22 | 22 | if (!class_exists('GL_Plugin_Check_v6')) { |
| 23 | - require_once __DIR__.'/activate.php'; |
|
| 23 | + require_once __DIR__.'/activate.php'; |
|
| 24 | 24 | } |
| 25 | 25 | if ((new GL_Plugin_Check_v6(__FILE__))->canProceed()) { |
| 26 | - require_once __DIR__.'/autoload.php'; |
|
| 27 | - require_once __DIR__.'/compatibility.php'; |
|
| 28 | - if (!defined('SAVEQUERIES')) { |
|
| 29 | - define('SAVEQUERIES', 1); |
|
| 30 | - } |
|
| 31 | - GeminiLabs\BlackBar\Application::load()->init(); |
|
| 26 | + require_once __DIR__.'/autoload.php'; |
|
| 27 | + require_once __DIR__.'/compatibility.php'; |
|
| 28 | + if (!defined('SAVEQUERIES')) { |
|
| 29 | + define('SAVEQUERIES', 1); |
|
| 30 | + } |
|
| 31 | + GeminiLabs\BlackBar\Application::load()->init(); |
|
| 32 | 32 | } |
@@ -6,64 +6,64 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Templates implements Module |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @var Application |
|
| 11 | - */ |
|
| 12 | - protected $app; |
|
| 13 | - /** |
|
| 14 | - * @var array |
|
| 15 | - */ |
|
| 16 | - protected $entries; |
|
| 9 | + /** |
|
| 10 | + * @var Application |
|
| 11 | + */ |
|
| 12 | + protected $app; |
|
| 13 | + /** |
|
| 14 | + * @var array |
|
| 15 | + */ |
|
| 16 | + protected $entries; |
|
| 17 | 17 | |
| 18 | - public function __construct(Application $app) |
|
| 19 | - { |
|
| 20 | - $this->app = $app; |
|
| 21 | - $this->entries = []; |
|
| 22 | - } |
|
| 18 | + public function __construct(Application $app) |
|
| 19 | + { |
|
| 20 | + $this->app = $app; |
|
| 21 | + $this->entries = []; |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - public function entries(): array |
|
| 25 | - { |
|
| 26 | - if (!empty($this->entries)) { |
|
| 27 | - return $this->entries; |
|
| 28 | - } |
|
| 29 | - if (class_exists('\GeminiLabs\Castor\Facades\Development') |
|
| 30 | - && class_exists('\GeminiLabs\Castor\Helpers\Development') |
|
| 31 | - && method_exists('\GeminiLabs\Castor\Helpers\Development', 'templatePaths')) { // @phpstan-ignore-line |
|
| 32 | - $this->entries = \GeminiLabs\Castor\Facades\Development::templatePaths(); |
|
| 33 | - } else { |
|
| 34 | - $files = array_values(array_filter(get_included_files(), function ($file) { |
|
| 35 | - $bool = false !== strpos($file, '/themes/') && false === strpos($file, '/functions.php'); |
|
| 36 | - return (bool) apply_filters('blackbar/templates/file', $bool, $file); |
|
| 37 | - })); |
|
| 38 | - $this->entries = array_map(function ($file) { |
|
| 39 | - return str_replace(trailingslashit(WP_CONTENT_DIR), '', $file); |
|
| 40 | - }, $files); |
|
| 41 | - } |
|
| 42 | - return $this->entries; |
|
| 43 | - } |
|
| 24 | + public function entries(): array |
|
| 25 | + { |
|
| 26 | + if (!empty($this->entries)) { |
|
| 27 | + return $this->entries; |
|
| 28 | + } |
|
| 29 | + if (class_exists('\GeminiLabs\Castor\Facades\Development') |
|
| 30 | + && class_exists('\GeminiLabs\Castor\Helpers\Development') |
|
| 31 | + && method_exists('\GeminiLabs\Castor\Helpers\Development', 'templatePaths')) { // @phpstan-ignore-line |
|
| 32 | + $this->entries = \GeminiLabs\Castor\Facades\Development::templatePaths(); |
|
| 33 | + } else { |
|
| 34 | + $files = array_values(array_filter(get_included_files(), function ($file) { |
|
| 35 | + $bool = false !== strpos($file, '/themes/') && false === strpos($file, '/functions.php'); |
|
| 36 | + return (bool) apply_filters('blackbar/templates/file', $bool, $file); |
|
| 37 | + })); |
|
| 38 | + $this->entries = array_map(function ($file) { |
|
| 39 | + return str_replace(trailingslashit(WP_CONTENT_DIR), '', $file); |
|
| 40 | + }, $files); |
|
| 41 | + } |
|
| 42 | + return $this->entries; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - public function hasEntries(): bool |
|
| 46 | - { |
|
| 47 | - return !empty($this->entries()); |
|
| 48 | - } |
|
| 45 | + public function hasEntries(): bool |
|
| 46 | + { |
|
| 47 | + return !empty($this->entries()); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - public function id(): string |
|
| 51 | - { |
|
| 52 | - return 'glbb-templates'; |
|
| 53 | - } |
|
| 50 | + public function id(): string |
|
| 51 | + { |
|
| 52 | + return 'glbb-templates'; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - public function isVisible(): bool |
|
| 56 | - { |
|
| 57 | - return !is_admin(); |
|
| 58 | - } |
|
| 55 | + public function isVisible(): bool |
|
| 56 | + { |
|
| 57 | + return !is_admin(); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - public function label(): string |
|
| 61 | - { |
|
| 62 | - return __('Templates', 'blackbar'); |
|
| 63 | - } |
|
| 60 | + public function label(): string |
|
| 61 | + { |
|
| 62 | + return __('Templates', 'blackbar'); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - public function render(): void |
|
| 66 | - { |
|
| 67 | - $this->app->render('panels/templates', ['templates' => $this]); |
|
| 68 | - } |
|
| 65 | + public function render(): void |
|
| 66 | + { |
|
| 67 | + $this->app->render('panels/templates', ['templates' => $this]); |
|
| 68 | + } |
|
| 69 | 69 | } |
@@ -4,10 +4,10 @@ |
||
| 4 | 4 | |
| 5 | 5 | interface Module |
| 6 | 6 | { |
| 7 | - public function entries(): array; |
|
| 8 | - public function hasEntries(): bool; |
|
| 9 | - public function id(): string; |
|
| 10 | - public function isVisible(): bool; |
|
| 11 | - public function label(): string; |
|
| 12 | - public function render(): void; |
|
| 7 | + public function entries(): array; |
|
| 8 | + public function hasEntries(): bool; |
|
| 9 | + public function id(): string; |
|
| 10 | + public function isVisible(): bool; |
|
| 11 | + public function label(): string; |
|
| 12 | + public function render(): void; |
|
| 13 | 13 | } |
@@ -6,75 +6,75 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Globals implements Module |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @var Application |
|
| 11 | - */ |
|
| 12 | - protected $app; |
|
| 13 | - /** |
|
| 14 | - * @var array |
|
| 15 | - */ |
|
| 16 | - protected $entries; |
|
| 9 | + /** |
|
| 10 | + * @var Application |
|
| 11 | + */ |
|
| 12 | + protected $app; |
|
| 13 | + /** |
|
| 14 | + * @var array |
|
| 15 | + */ |
|
| 16 | + protected $entries; |
|
| 17 | 17 | |
| 18 | - public function __construct(Application $app) |
|
| 19 | - { |
|
| 20 | - $this->app = $app; |
|
| 21 | - $this->entries = []; |
|
| 22 | - } |
|
| 18 | + public function __construct(Application $app) |
|
| 19 | + { |
|
| 20 | + $this->app = $app; |
|
| 21 | + $this->entries = []; |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - public function entries(): array |
|
| 25 | - { |
|
| 26 | - if (!empty($this->entries)) { |
|
| 27 | - return $this->entries; |
|
| 28 | - } |
|
| 29 | - $globals = [ |
|
| 30 | - 'INPUT_COOKIE' => $_COOKIE, |
|
| 31 | - 'INPUT_ENV' => $_ENV, |
|
| 32 | - 'INPUT_GET' => $_GET, |
|
| 33 | - 'INPUT_POST' => $_POST, |
|
| 34 | - 'INPUT_SERVER' => $_SERVER, |
|
| 35 | - ]; |
|
| 36 | - if (is_admin() && $screen = get_current_screen()) { |
|
| 37 | - $reflection = new \ReflectionClass($screen); |
|
| 38 | - $properties = $reflection->getProperties(\ReflectionProperty::IS_PUBLIC); |
|
| 39 | - $values = []; |
|
| 40 | - foreach ($properties as $property) { |
|
| 41 | - $values[$property->getName()] = $property->getValue($screen); |
|
| 42 | - } |
|
| 43 | - $globals['WP_Screen'] = $values; |
|
| 44 | - } |
|
| 45 | - $globals = apply_filters('blackbar/globals', $globals); |
|
| 46 | - $globals = array_filter($globals); |
|
| 47 | - foreach ($globals as $key => $values) { |
|
| 48 | - $this->entries[] = [ |
|
| 49 | - 'name' => $key, |
|
| 50 | - 'value' => var_export($values, true), |
|
| 51 | - ]; |
|
| 52 | - } |
|
| 53 | - return $this->entries; |
|
| 54 | - } |
|
| 24 | + public function entries(): array |
|
| 25 | + { |
|
| 26 | + if (!empty($this->entries)) { |
|
| 27 | + return $this->entries; |
|
| 28 | + } |
|
| 29 | + $globals = [ |
|
| 30 | + 'INPUT_COOKIE' => $_COOKIE, |
|
| 31 | + 'INPUT_ENV' => $_ENV, |
|
| 32 | + 'INPUT_GET' => $_GET, |
|
| 33 | + 'INPUT_POST' => $_POST, |
|
| 34 | + 'INPUT_SERVER' => $_SERVER, |
|
| 35 | + ]; |
|
| 36 | + if (is_admin() && $screen = get_current_screen()) { |
|
| 37 | + $reflection = new \ReflectionClass($screen); |
|
| 38 | + $properties = $reflection->getProperties(\ReflectionProperty::IS_PUBLIC); |
|
| 39 | + $values = []; |
|
| 40 | + foreach ($properties as $property) { |
|
| 41 | + $values[$property->getName()] = $property->getValue($screen); |
|
| 42 | + } |
|
| 43 | + $globals['WP_Screen'] = $values; |
|
| 44 | + } |
|
| 45 | + $globals = apply_filters('blackbar/globals', $globals); |
|
| 46 | + $globals = array_filter($globals); |
|
| 47 | + foreach ($globals as $key => $values) { |
|
| 48 | + $this->entries[] = [ |
|
| 49 | + 'name' => $key, |
|
| 50 | + 'value' => var_export($values, true), |
|
| 51 | + ]; |
|
| 52 | + } |
|
| 53 | + return $this->entries; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - public function hasEntries(): bool |
|
| 57 | - { |
|
| 58 | - return !empty($this->entries()); |
|
| 59 | - } |
|
| 56 | + public function hasEntries(): bool |
|
| 57 | + { |
|
| 58 | + return !empty($this->entries()); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public function id(): string |
|
| 62 | - { |
|
| 63 | - return 'glbb-globals'; |
|
| 64 | - } |
|
| 61 | + public function id(): string |
|
| 62 | + { |
|
| 63 | + return 'glbb-globals'; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - public function isVisible(): bool |
|
| 67 | - { |
|
| 68 | - return true; |
|
| 69 | - } |
|
| 66 | + public function isVisible(): bool |
|
| 67 | + { |
|
| 68 | + return true; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - public function label(): string |
|
| 72 | - { |
|
| 73 | - return __('Globals', 'blackbar'); |
|
| 74 | - } |
|
| 71 | + public function label(): string |
|
| 72 | + { |
|
| 73 | + return __('Globals', 'blackbar'); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - public function render(): void |
|
| 77 | - { |
|
| 78 | - $this->app->render('panels/globals', ['globals' => $this]); |
|
| 79 | - } |
|
| 76 | + public function render(): void |
|
| 77 | + { |
|
| 78 | + $this->app->render('panels/globals', ['globals' => $this]); |
|
| 79 | + } |
|
| 80 | 80 | } |
@@ -6,130 +6,130 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Profiler implements Module |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @var Application |
|
| 11 | - */ |
|
| 12 | - protected $app; |
|
| 13 | - /** |
|
| 14 | - * @var float |
|
| 15 | - */ |
|
| 16 | - protected $noise; |
|
| 17 | - /** |
|
| 18 | - * @var float |
|
| 19 | - */ |
|
| 20 | - protected $start; |
|
| 21 | - /** |
|
| 22 | - * @var float |
|
| 23 | - */ |
|
| 24 | - protected $stop; |
|
| 25 | - /** |
|
| 26 | - * @var array |
|
| 27 | - */ |
|
| 28 | - protected $timer; |
|
| 29 | - /** |
|
| 30 | - * @var array |
|
| 31 | - */ |
|
| 32 | - protected $timers; |
|
| 33 | - |
|
| 34 | - public function __construct(Application $app) |
|
| 35 | - { |
|
| 36 | - $this->app = $app; |
|
| 37 | - $this->noise = floatval(0); |
|
| 38 | - $this->start = floatval(0); |
|
| 39 | - $this->stop = floatval(0); |
|
| 40 | - $this->timer = []; |
|
| 41 | - $this->timers = []; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - public function entries(): array |
|
| 45 | - { |
|
| 46 | - $entries = []; |
|
| 47 | - foreach ($this->timers as $timer) { |
|
| 48 | - $timer['memory'] = round($timer['memory'] / 1000); // convert bytes to KB |
|
| 49 | - $timer['time'] = $this->formatTime($timer['time']); |
|
| 50 | - $entries[] = $timer; |
|
| 51 | - } |
|
| 52 | - return $entries; |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - public function hasEntries(): bool |
|
| 56 | - { |
|
| 57 | - return !empty($this->timers); |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - public function id(): string |
|
| 61 | - { |
|
| 62 | - return 'glbb-profiler'; |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - public function isVisible(): bool |
|
| 66 | - { |
|
| 67 | - return !empty($this->timers); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - public function label(): string |
|
| 71 | - { |
|
| 72 | - $label = __('Profiler', 'blackbar'); |
|
| 73 | - $time = $this->totalTime(); |
|
| 74 | - if ($time > 0) { |
|
| 75 | - $info = sprintf('<span class="glbb-link-info">(%s)</span>', $this->formatTime($time)); |
|
| 76 | - $label = sprintf('%s %s', $label, $info); |
|
| 77 | - } |
|
| 78 | - return $label; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - public function render(): void |
|
| 82 | - { |
|
| 83 | - $this->app->render('panels/profiler', ['profiler' => $this]); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - public function setNoise(float $microtime): void |
|
| 87 | - { |
|
| 88 | - $this->noise = $this->start - $microtime; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - public function setStart(float $microtime): void |
|
| 92 | - { |
|
| 93 | - $this->start = $microtime; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - public function setStop(float $microtime): void |
|
| 97 | - { |
|
| 98 | - $this->stop = $microtime; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - public function start(string $name): void |
|
| 102 | - { |
|
| 103 | - $this->timer = [ |
|
| 104 | - 'memory' => memory_get_peak_usage(), |
|
| 105 | - 'name' => $name, |
|
| 106 | - 'start' => microtime(true), |
|
| 107 | - 'stop' => floatval(0), |
|
| 108 | - 'time' => floatval(0), |
|
| 109 | - ]; |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - public function stop(string $name): void |
|
| 113 | - { |
|
| 114 | - if (empty($this->timer)) { |
|
| 115 | - return; |
|
| 116 | - } |
|
| 117 | - $this->timer['stop'] = microtime(true) - $this->noise; |
|
| 118 | - $this->timer['time'] = $this->timer['stop'] - $this->timer['start']; |
|
| 119 | - $this->timers[] = $this->timer; |
|
| 120 | - $this->timer = []; // reset timer |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - public function totalTime(): float |
|
| 124 | - { |
|
| 125 | - return array_sum(wp_list_pluck($this->timers, 'time')); |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - protected function formatTime(float $time): string |
|
| 129 | - { |
|
| 130 | - if ($time < 100) { |
|
| 131 | - return sprintf('%.3f µs', $time); |
|
| 132 | - } |
|
| 133 | - return sprintf('%.3f ms', $time * 1000); |
|
| 134 | - } |
|
| 9 | + /** |
|
| 10 | + * @var Application |
|
| 11 | + */ |
|
| 12 | + protected $app; |
|
| 13 | + /** |
|
| 14 | + * @var float |
|
| 15 | + */ |
|
| 16 | + protected $noise; |
|
| 17 | + /** |
|
| 18 | + * @var float |
|
| 19 | + */ |
|
| 20 | + protected $start; |
|
| 21 | + /** |
|
| 22 | + * @var float |
|
| 23 | + */ |
|
| 24 | + protected $stop; |
|
| 25 | + /** |
|
| 26 | + * @var array |
|
| 27 | + */ |
|
| 28 | + protected $timer; |
|
| 29 | + /** |
|
| 30 | + * @var array |
|
| 31 | + */ |
|
| 32 | + protected $timers; |
|
| 33 | + |
|
| 34 | + public function __construct(Application $app) |
|
| 35 | + { |
|
| 36 | + $this->app = $app; |
|
| 37 | + $this->noise = floatval(0); |
|
| 38 | + $this->start = floatval(0); |
|
| 39 | + $this->stop = floatval(0); |
|
| 40 | + $this->timer = []; |
|
| 41 | + $this->timers = []; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + public function entries(): array |
|
| 45 | + { |
|
| 46 | + $entries = []; |
|
| 47 | + foreach ($this->timers as $timer) { |
|
| 48 | + $timer['memory'] = round($timer['memory'] / 1000); // convert bytes to KB |
|
| 49 | + $timer['time'] = $this->formatTime($timer['time']); |
|
| 50 | + $entries[] = $timer; |
|
| 51 | + } |
|
| 52 | + return $entries; |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + public function hasEntries(): bool |
|
| 56 | + { |
|
| 57 | + return !empty($this->timers); |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + public function id(): string |
|
| 61 | + { |
|
| 62 | + return 'glbb-profiler'; |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + public function isVisible(): bool |
|
| 66 | + { |
|
| 67 | + return !empty($this->timers); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + public function label(): string |
|
| 71 | + { |
|
| 72 | + $label = __('Profiler', 'blackbar'); |
|
| 73 | + $time = $this->totalTime(); |
|
| 74 | + if ($time > 0) { |
|
| 75 | + $info = sprintf('<span class="glbb-link-info">(%s)</span>', $this->formatTime($time)); |
|
| 76 | + $label = sprintf('%s %s', $label, $info); |
|
| 77 | + } |
|
| 78 | + return $label; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + public function render(): void |
|
| 82 | + { |
|
| 83 | + $this->app->render('panels/profiler', ['profiler' => $this]); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + public function setNoise(float $microtime): void |
|
| 87 | + { |
|
| 88 | + $this->noise = $this->start - $microtime; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + public function setStart(float $microtime): void |
|
| 92 | + { |
|
| 93 | + $this->start = $microtime; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + public function setStop(float $microtime): void |
|
| 97 | + { |
|
| 98 | + $this->stop = $microtime; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + public function start(string $name): void |
|
| 102 | + { |
|
| 103 | + $this->timer = [ |
|
| 104 | + 'memory' => memory_get_peak_usage(), |
|
| 105 | + 'name' => $name, |
|
| 106 | + 'start' => microtime(true), |
|
| 107 | + 'stop' => floatval(0), |
|
| 108 | + 'time' => floatval(0), |
|
| 109 | + ]; |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + public function stop(string $name): void |
|
| 113 | + { |
|
| 114 | + if (empty($this->timer)) { |
|
| 115 | + return; |
|
| 116 | + } |
|
| 117 | + $this->timer['stop'] = microtime(true) - $this->noise; |
|
| 118 | + $this->timer['time'] = $this->timer['stop'] - $this->timer['start']; |
|
| 119 | + $this->timers[] = $this->timer; |
|
| 120 | + $this->timer = []; // reset timer |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + public function totalTime(): float |
|
| 124 | + { |
|
| 125 | + return array_sum(wp_list_pluck($this->timers, 'time')); |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + protected function formatTime(float $time): string |
|
| 129 | + { |
|
| 130 | + if ($time < 100) { |
|
| 131 | + return sprintf('%.3f µs', $time); |
|
| 132 | + } |
|
| 133 | + return sprintf('%.3f ms', $time * 1000); |
|
| 134 | + } |
|
| 135 | 135 | } |
@@ -6,100 +6,100 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Queries implements Module |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @var Application |
|
| 11 | - */ |
|
| 12 | - protected $app; |
|
| 9 | + /** |
|
| 10 | + * @var Application |
|
| 11 | + */ |
|
| 12 | + protected $app; |
|
| 13 | 13 | |
| 14 | - public function __construct(Application $app) |
|
| 15 | - { |
|
| 16 | - $this->app = $app; |
|
| 17 | - } |
|
| 14 | + public function __construct(Application $app) |
|
| 15 | + { |
|
| 16 | + $this->app = $app; |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - public function entries(): array |
|
| 20 | - { |
|
| 21 | - global $wpdb; |
|
| 22 | - $entries = []; |
|
| 23 | - $index = 0; |
|
| 24 | - $search = [ |
|
| 25 | - 'FROM', 'GROUP BY', 'INNER JOIN', 'LEFT JOIN', 'LIMIT', |
|
| 26 | - 'ON DUPLICATE KEY UPDATE', 'ORDER BY', 'OFFSET', ' SET', 'WHERE', |
|
| 27 | - ]; |
|
| 28 | - $replace = array_map(function ($value) { |
|
| 29 | - return PHP_EOL.$value; |
|
| 30 | - }, $search); |
|
| 31 | - foreach ($wpdb->queries as $query) { |
|
| 32 | - $miliseconds = number_format(round($query[1] * 1000, 4), 4); |
|
| 33 | - $sql = preg_replace('/\s\s+/', ' ', trim($query[0])); |
|
| 34 | - $sql = str_replace(PHP_EOL, ' ', $sql); |
|
| 35 | - $sql = str_replace(['( ',' )',' ,'], ['(',')',','], $sql); |
|
| 36 | - $sql = str_replace($search, $replace, $sql); |
|
| 37 | - $parts = explode(PHP_EOL, $sql); |
|
| 38 | - $sql = array_reduce($parts, function ($carry, $part) { |
|
| 39 | - if (str_starts_with($part, 'SELECT') && strlen($part) > 100) { |
|
| 40 | - $part = preg_replace('/\s*(,)\s*/', ','.PHP_EOL.' ', $part); |
|
| 41 | - } |
|
| 42 | - if (str_starts_with($part, 'WHERE')) { |
|
| 43 | - $part = str_replace('AND', PHP_EOL.' AND', $part); |
|
| 44 | - } |
|
| 45 | - return $carry.$part.PHP_EOL; |
|
| 46 | - }); |
|
| 47 | - $trace = explode(', ', $query[2]); |
|
| 48 | - $entries[] = [ |
|
| 49 | - 'index' => $index++, |
|
| 50 | - 'sql' => $sql, |
|
| 51 | - 'time' => $miliseconds, |
|
| 52 | - 'trace' => array_reverse($trace, true), |
|
| 53 | - ]; |
|
| 54 | - } |
|
| 55 | - uasort($entries, [$this, 'sortByTime']); |
|
| 56 | - return $entries; |
|
| 57 | - } |
|
| 19 | + public function entries(): array |
|
| 20 | + { |
|
| 21 | + global $wpdb; |
|
| 22 | + $entries = []; |
|
| 23 | + $index = 0; |
|
| 24 | + $search = [ |
|
| 25 | + 'FROM', 'GROUP BY', 'INNER JOIN', 'LEFT JOIN', 'LIMIT', |
|
| 26 | + 'ON DUPLICATE KEY UPDATE', 'ORDER BY', 'OFFSET', ' SET', 'WHERE', |
|
| 27 | + ]; |
|
| 28 | + $replace = array_map(function ($value) { |
|
| 29 | + return PHP_EOL.$value; |
|
| 30 | + }, $search); |
|
| 31 | + foreach ($wpdb->queries as $query) { |
|
| 32 | + $miliseconds = number_format(round($query[1] * 1000, 4), 4); |
|
| 33 | + $sql = preg_replace('/\s\s+/', ' ', trim($query[0])); |
|
| 34 | + $sql = str_replace(PHP_EOL, ' ', $sql); |
|
| 35 | + $sql = str_replace(['( ',' )',' ,'], ['(',')',','], $sql); |
|
| 36 | + $sql = str_replace($search, $replace, $sql); |
|
| 37 | + $parts = explode(PHP_EOL, $sql); |
|
| 38 | + $sql = array_reduce($parts, function ($carry, $part) { |
|
| 39 | + if (str_starts_with($part, 'SELECT') && strlen($part) > 100) { |
|
| 40 | + $part = preg_replace('/\s*(,)\s*/', ','.PHP_EOL.' ', $part); |
|
| 41 | + } |
|
| 42 | + if (str_starts_with($part, 'WHERE')) { |
|
| 43 | + $part = str_replace('AND', PHP_EOL.' AND', $part); |
|
| 44 | + } |
|
| 45 | + return $carry.$part.PHP_EOL; |
|
| 46 | + }); |
|
| 47 | + $trace = explode(', ', $query[2]); |
|
| 48 | + $entries[] = [ |
|
| 49 | + 'index' => $index++, |
|
| 50 | + 'sql' => $sql, |
|
| 51 | + 'time' => $miliseconds, |
|
| 52 | + 'trace' => array_reverse($trace, true), |
|
| 53 | + ]; |
|
| 54 | + } |
|
| 55 | + uasort($entries, [$this, 'sortByTime']); |
|
| 56 | + return $entries; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - public function hasEntries(): bool |
|
| 60 | - { |
|
| 61 | - global $wpdb; |
|
| 62 | - return !empty($wpdb->queries); |
|
| 63 | - } |
|
| 59 | + public function hasEntries(): bool |
|
| 60 | + { |
|
| 61 | + global $wpdb; |
|
| 62 | + return !empty($wpdb->queries); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - public function id(): string |
|
| 66 | - { |
|
| 67 | - return 'glbb-queries'; |
|
| 68 | - } |
|
| 65 | + public function id(): string |
|
| 66 | + { |
|
| 67 | + return 'glbb-queries'; |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - public function isVisible(): bool |
|
| 71 | - { |
|
| 72 | - return true; |
|
| 73 | - } |
|
| 70 | + public function isVisible(): bool |
|
| 71 | + { |
|
| 72 | + return true; |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - public function label(): string |
|
| 76 | - { |
|
| 77 | - $label = __('SQL', 'blackbar'); |
|
| 78 | - if (!defined('SAVEQUERIES') || !SAVEQUERIES) { |
|
| 79 | - return $label; |
|
| 80 | - } |
|
| 81 | - global $wpdb; |
|
| 82 | - $queryTime = 0; |
|
| 83 | - foreach ($wpdb->queries as $query) { |
|
| 84 | - $queryTime += $query[1]; |
|
| 85 | - } |
|
| 86 | - $queryTime = number_format($queryTime * 1000, 2); |
|
| 87 | - $queriesCount = sprintf('<span class="glbb-queries-count">%s</span>', count($wpdb->queries)); |
|
| 88 | - $queriesTime = sprintf('<span class="glbb-queries-time">%s</span>', $queryTime); |
|
| 89 | - $info = sprintf('<span class="glbb-link-info">(%s / %s ms)</span>', $queriesCount, $queriesTime); |
|
| 90 | - return sprintf('%s %s', $label, $info); |
|
| 91 | - } |
|
| 75 | + public function label(): string |
|
| 76 | + { |
|
| 77 | + $label = __('SQL', 'blackbar'); |
|
| 78 | + if (!defined('SAVEQUERIES') || !SAVEQUERIES) { |
|
| 79 | + return $label; |
|
| 80 | + } |
|
| 81 | + global $wpdb; |
|
| 82 | + $queryTime = 0; |
|
| 83 | + foreach ($wpdb->queries as $query) { |
|
| 84 | + $queryTime += $query[1]; |
|
| 85 | + } |
|
| 86 | + $queryTime = number_format($queryTime * 1000, 2); |
|
| 87 | + $queriesCount = sprintf('<span class="glbb-queries-count">%s</span>', count($wpdb->queries)); |
|
| 88 | + $queriesTime = sprintf('<span class="glbb-queries-time">%s</span>', $queryTime); |
|
| 89 | + $info = sprintf('<span class="glbb-link-info">(%s / %s ms)</span>', $queriesCount, $queriesTime); |
|
| 90 | + return sprintf('%s %s', $label, $info); |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - public function render(): void |
|
| 94 | - { |
|
| 95 | - $this->app->render('panels/queries', ['queries' => $this]); |
|
| 96 | - } |
|
| 93 | + public function render(): void |
|
| 94 | + { |
|
| 95 | + $this->app->render('panels/queries', ['queries' => $this]); |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - protected function sortByTime(array $a, array $b): int |
|
| 99 | - { |
|
| 100 | - if ($a['time'] !== $b['time']) { |
|
| 101 | - return ($a['time'] > $b['time']) ? -1 : 1; |
|
| 102 | - } |
|
| 103 | - return 0; |
|
| 104 | - } |
|
| 98 | + protected function sortByTime(array $a, array $b): int |
|
| 99 | + { |
|
| 100 | + if ($a['time'] !== $b['time']) { |
|
| 101 | + return ($a['time'] > $b['time']) ? -1 : 1; |
|
| 102 | + } |
|
| 103 | + return 0; |
|
| 104 | + } |
|
| 105 | 105 | } |