@@ -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; |
@@ -2,7 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | defined('WPINC') || die; |
| 4 | 4 | |
| 5 | -spl_autoload_register(function ($className) { |
|
| 5 | +spl_autoload_register(function ($className) |
|
| 6 | +{ |
|
| 6 | 7 | $namespaces = [ |
| 7 | 8 | 'GeminiLabs\\BlackBar\\' => __DIR__.'/plugin/', |
| 8 | 9 | 'GeminiLabs\\BlackBar\\Tests\\' => __DIR__.'/tests/', |
@@ -124,7 +124,8 @@ |
||
| 124 | 124 | sprintf($messages['wrong_version'], $messages['php_version'].' '.$this->versions['php']), |
| 125 | 125 | sprintf($messages['update_php'], PHP_VERSION).'</p><p>'.$rollbackMessage |
| 126 | 126 | ); |
| 127 | - } elseif (!$this->isWpValid()) { |
|
| 127 | + } |
|
| 128 | + elseif (!$this->isWpValid()) { |
|
| 128 | 129 | printf($noticeTemplate, |
| 129 | 130 | sprintf($messages['notice'], $pluginName), |
| 130 | 131 | sprintf($messages['wrong_version'], $messages['wp_version'].' '.$this->versions['wordpress']), |
@@ -52,7 +52,8 @@ |
||
| 52 | 52 | add_action('all', [$controller, 'initConsole']); |
| 53 | 53 | add_action('all', [$controller, 'initProfiler']); |
| 54 | 54 | add_action('plugins_loaded', [$controller, 'registerLanguages']); |
| 55 | - add_action('init', function () use ($controller) { |
|
| 55 | + add_action('init', function () use ($controller) |
|
| 56 | + { |
|
| 56 | 57 | if (!apply_filters('blackbar/enabled', current_user_can('administrator'))) { |
| 57 | 58 | return; |
| 58 | 59 | } |
@@ -30,12 +30,15 @@ |
||
| 30 | 30 | && class_exists('\GeminiLabs\Castor\Helpers\Development') |
| 31 | 31 | && method_exists('\GeminiLabs\Castor\Helpers\Development', 'templatePaths')) { // @phpstan-ignore-line |
| 32 | 32 | $this->entries = \GeminiLabs\Castor\Facades\Development::templatePaths(); |
| 33 | - } else { |
|
| 34 | - $files = array_values(array_filter(get_included_files(), function ($file) { |
|
| 33 | + } |
|
| 34 | + else { |
|
| 35 | + $files = array_values(array_filter(get_included_files(), function ($file) |
|
| 36 | + { |
|
| 35 | 37 | $bool = false !== strpos($file, '/themes/') && false === strpos($file, '/functions.php'); |
| 36 | 38 | return (bool) apply_filters('blackbar/templates/file', $bool, $file); |
| 37 | 39 | })); |
| 38 | - $this->entries = array_map(function ($file) { |
|
| 40 | + $this->entries = array_map(function ($file) |
|
| 41 | + { |
|
| 39 | 42 | return str_replace(trailingslashit(WP_CONTENT_DIR), '', $file); |
| 40 | 43 | }, $files); |
| 41 | 44 | } |
@@ -24,7 +24,8 @@ |
||
| 24 | 24 | 'AND', 'FROM', 'GROUP BY', 'INNER JOIN', 'LEFT JOIN', 'LIMIT', |
| 25 | 25 | 'ON DUPLICATE KEY UPDATE', 'ORDER BY', 'OFFSET', ' SET', 'WHERE', |
| 26 | 26 | ]; |
| 27 | - $replace = array_map(function ($value) { |
|
| 27 | + $replace = array_map(function ($value) |
|
| 28 | + { |
|
| 28 | 29 | return PHP_EOL.$value; |
| 29 | 30 | }, $search); |
| 30 | 31 | foreach ($wpdb->queries as $query) { |
@@ -87,7 +87,8 @@ discard block |
||
| 87 | 87 | if ($errorCount > 0) { |
| 88 | 88 | $class = 'glbb-error'; |
| 89 | 89 | $label = sprintf('%s (%d, %d!)', $label, $entryCount, $errorCount); |
| 90 | - } elseif ($entryCount > 0) { |
|
| 90 | + } |
|
| 91 | + elseif ($entryCount > 0) { |
|
| 91 | 92 | $label = sprintf('%s (%d)', $label, $entryCount); |
| 92 | 93 | } |
| 93 | 94 | return sprintf('<span class="%s">%s</span>', $class, $label); |
@@ -106,7 +107,8 @@ discard block |
||
| 106 | 107 | if (array_key_exists((int) $errno, static::ERROR_CODES)) { |
| 107 | 108 | $errname = static::ERROR_CODES[$errno]; |
| 108 | 109 | } |
| 109 | - } else { |
|
| 110 | + } |
|
| 111 | + else { |
|
| 110 | 112 | // entry likely stored by filter hook |
| 111 | 113 | $errname = 'Debug'; |
| 112 | 114 | if (array_key_exists($errno, static::MAPPED_ERROR_CODES)) { |
@@ -118,7 +120,8 @@ discard block |
||
| 118 | 120 | $hash = md5($errno.$errname.$message.$location); |
| 119 | 121 | if (array_key_exists($hash, $this->entries)) { |
| 120 | 122 | ++$this->entries[$hash]['count']; |
| 121 | - } else { |
|
| 123 | + } |
|
| 124 | + else { |
|
| 122 | 125 | $this->entries[$hash] = [ |
| 123 | 126 | 'count' => 0, |
| 124 | 127 | 'errname' => $errname, |
@@ -132,9 +135,11 @@ discard block |
||
| 132 | 135 | { |
| 133 | 136 | if ($message instanceof \DateTime) { |
| 134 | 137 | $message = $message->format('Y-m-d H:i:s'); |
| 135 | - } elseif (is_object($message) || is_array($message)) { |
|
| 138 | + } |
|
| 139 | + elseif (is_object($message) || is_array($message)) { |
|
| 136 | 140 | $message = print_r(json_decode(json_encode($message)), true); |
| 137 | - } else { |
|
| 141 | + } |
|
| 142 | + else { |
|
| 138 | 143 | $message = esc_html(trim((string) $message)); |
| 139 | 144 | } |
| 140 | 145 | $location = trim($location); |
@@ -58,9 +58,11 @@ |
||
| 58 | 58 | // } |
| 59 | 59 | } |
| 60 | 60 | $this->hooks[$action]['callbacks'][$priority][] = sprintf('%s::%s', $object, $method); |
| 61 | - } elseif (is_object($callback['function'])) { |
|
| 61 | + } |
|
| 62 | + elseif (is_object($callback['function'])) { |
|
| 62 | 63 | $this->hooks[$action]['callbacks'][$priority][] = get_class($callback['function']); |
| 63 | - } else { |
|
| 64 | + } |
|
| 65 | + else { |
|
| 64 | 66 | $this->hooks[$action]['callbacks'][$priority][] = $callback['function']; |
| 65 | 67 | } |
| 66 | 68 | ++$this->hooks[$action]['callbacks_count']; |
@@ -5,7 +5,10 @@ |
||
| 5 | 5 | <?= __('Toggle', 'blackbar'); ?> |
| 6 | 6 | </a> |
| 7 | 7 | <?php foreach ($modules as $module) : ?> |
| 8 | - <?php if (!$module->isVisible()) continue; ?> |
|
| 8 | + <?php if (!$module->isVisible()) { |
|
| 9 | + continue; |
|
| 10 | +} |
|
| 11 | +?> |
|
| 9 | 12 | <a href="javascript:Blackbar.switchPanel('<?= $module->id(); ?>')" class="<?= $module->id(); ?>"> |
| 10 | 13 | <?= $module->label(); ?> |
| 11 | 14 | </a> |