| Total Complexity | 6 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class LinkManager extends Module |
||
| 9 | { |
||
| 10 | use TargetsInitHook; |
||
| 11 | |||
| 12 | public function hook(): void |
||
| 15 | } |
||
| 16 | |||
| 17 | protected function doInitAction(): void |
||
| 18 | { |
||
| 19 | $enabled = $this->enabledLinks(); |
||
| 20 | |||
| 21 | foreach ($this->links() as $link => $args) { |
||
| 22 | if (!in_array($link, $enabled)) { |
||
| 23 | $callback = $args[0]; |
||
| 24 | $priority = $args[1] ?? HOOK_DEFAULT_PRIORITY; |
||
| 25 | |||
| 26 | remove_action('wp_head', $callback, $priority); |
||
| 27 | } |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | protected function links(): array |
||
| 40 | ]; |
||
| 41 | } |
||
| 42 | |||
| 43 | protected function enabledLinks(): array |
||
| 48 |