| Total Complexity | 9 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class Globals extends Module |
||
| 6 | { |
||
| 7 | public function entries(): array |
||
| 8 | { |
||
| 9 | if (!empty($this->entries)) { |
||
| 10 | return $this->entries; |
||
| 11 | } |
||
| 12 | $globals = apply_filters('blackbar/globals', [ |
||
| 13 | 'INPUT_COOKIE' => $_COOKIE, |
||
| 14 | 'INPUT_ENV' => $_ENV, |
||
| 15 | 'INPUT_GET' => $_GET, |
||
| 16 | 'INPUT_POST' => $_POST, |
||
| 17 | 'INPUT_SERVER' => $_SERVER, |
||
| 18 | 'WP_Screen' => $this->wpscreen(), |
||
| 19 | ]); |
||
| 20 | $globals = array_filter($globals); |
||
| 21 | foreach ($globals as $key => $values) { |
||
| 22 | $this->entries[] = [ |
||
| 23 | 'name' => $key, |
||
| 24 | 'value' => var_export($values, true), |
||
| 25 | ]; |
||
| 26 | } |
||
| 27 | return $this->entries; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function hasEntries(): bool |
||
| 31 | { |
||
| 32 | return !empty($this->entries()); |
||
| 33 | } |
||
| 34 | |||
| 35 | public function label(): string |
||
| 36 | { |
||
| 37 | return __('Globals', 'blackbar'); |
||
| 38 | } |
||
| 39 | |||
| 40 | protected function wpscreen(): array |
||
| 51 | } |
||
| 52 | } |
||
| 53 |