| 1 |
<?php |
| 2 |
/** |
| 3 |
* OpenStation — the admin bar a window builds instead of the real one. |
| 4 |
* |
| 5 |
* **This file is required lazily, not at bootstrap.** It extends |
| 6 |
* `WP_Admin_Bar`, which WordPress only loads inside |
| 7 |
* `_wp_admin_bar_init()` — requiring this at plugin load would fatal |
| 8 |
* on a missing parent. The `wp_admin_bar_class` filter runs *after* |
| 9 |
* that require, which is the one moment the parent is guaranteed |
| 10 |
* present, so {@see openstation_chromeless_silence_admin_bar()} pulls |
| 11 |
* this file in there. |
| 12 |
* |
| 13 |
* @package OpenStation |
| 14 |
*/ |
| 15 |
|
| 16 |
defined( 'ABSPATH' ) || exit; |
| 17 |
|
| 18 |
/** |
| 19 |
* A `WP_Admin_Bar` that never asks anyone for nodes. |
| 20 |
* |
| 21 |
* Fully functional in every other respect — `add_node()` works, |
| 22 |
* `get_nodes()` answers, `$wp_admin_bar` stays a real object — so a |
| 23 |
* plugin that touches the global outside the `admin_bar_menu` hook |
| 24 |
* finds what it expects. Only the solicitation is skipped. |
| 25 |
*/ |
| 26 |
class OpenStation_Silent_Admin_Bar extends WP_Admin_Bar { |
| 27 |
|
| 28 |
/** |
| 29 |
* Skips the `admin_bar_menu` hook. |
| 30 |
* |
| 31 |
* The parent's `add_menus()` registers core's twenty-odd node |
| 32 |
* callbacks and then fires `admin_bar_menu`, running every |
| 33 |
* callback any plugin has on it — each resolving links, counting |
| 34 |
* things, checking capabilities — to build a bar this window |
| 35 |
* never draws. |
| 36 |
*/ |
| 37 |
public function add_menus() {} |
| 38 |
} |
| 39 |
|