PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.0.0
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.0.0
1.1.10 1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 0.8.9 0.8.8 0.8.7 All 34 releases
desktop-mode / includes / render / shell.php

shell.php in OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin 1.0.0, at includes/render/shell.php

92 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * OpenStation — Shell markup injection.
4 *
5 * Emits the `<div id="os-shell">…</div>` skeleton at
6 * `in_admin_header @ 5`. The shell floats on top of the classic
7 * admin via `position: fixed`; the body class added by
8 * `body-classes.php` triggers the CSS that hides classic chrome.
9 *
10 * Extracted from `render.php` during the architecture-0.8.1 PHP
11 * slicing (phase 6).
12 *
13 * @package OpenStation
14 */
15
16 defined( 'ABSPATH' ) || exit;
17
18
19 /**
20 * Injects the desktop shell markup into the admin page.
21 *
22 * Runs on `in_admin_header` at priority 5 so the shell renders right
23 * after the classic admin bar but before the page content. The shell
24 * floats above the classic layout via `position: fixed` in CSS; the
25 * classic sidebar, body, and footer are hidden with `body.os-active`
26 * selectors.
27 */
28 function openstation_render_shell() {
29 if ( openstation_is_chromeless_request() || ! openstation_is_enabled() || openstation_is_classic_request() ) {
30 return;
31 }
32
33 /**
34 * Fires right before the desktop shell markup is rendered.
35 */
36 do_action( 'openstation_shell_before' );
37
38 // Stamp the user's admin color scheme onto the shell root so the
39 // variables.css per-scheme selectors kick in before first paint —
40 // doing this from JS on init() would show the default palette for a
41 // frame before swapping.
42 $scheme = sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
43
44 // Same reasoning for the active desktop theme: the compiled
45 // theme stylesheet keys off this attribute, so stamping it
46 // server-side means the first paint is already themed. Setting
47 // it from `applyDesktopTheme()` on boot would flash the default
48 // palette for a frame. Empty string when the user is on the
49 // system default (and nothing else about themes runs at all).
50 $desktop_theme = function_exists( 'openstation_active_desktop_theme_slug' )
51 ? openstation_active_desktop_theme_slug()
52 : '';
53 ?>
54 <div id="os-shell" class="os-shell" data-os-scheme="<?php echo esc_attr( $scheme ); ?>"<?php echo '' !== $desktop_theme ? ' data-os-desktop-theme="' . esc_attr( $desktop_theme ) . '"' : ''; ?> role="application" aria-label="<?php esc_attr_e( 'Desktop shell', 'desktop-mode' ); ?>">
55 <?php
56 /*
57 * Wallpaper layer — sits behind both the dock and the desktop
58 * area so a translucent dock bleeds through to the wallpaper
59 * (macOS pattern). Canvas-driven wallpapers mount their own
60 * DOM into this element; static CSS wallpapers just inherit
61 * the `--os-bg` custom property the shell sets at
62 * boot. Presentational only.
63 */
64 ?>
65 <div id="os-wallpaper" class="os-wallpaper" aria-hidden="true"></div>
66 <div class="os-shell__body">
67 <nav id="os-dock" class="os-dock" role="toolbar" aria-label="<?php esc_attr_e( 'Admin navigation', 'desktop-mode' ); ?>"></nav>
68 <div id="os-area" class="os-area os-area--with-dock os-area--booting">
69 <?php
70 /*
71 * Widget column — paints above the wallpaper but
72 * beneath windows (z-index 1 vs. windows at 100+).
73 * Hosted INSIDE `.os-area` so scrolling the
74 * area (not that we do today) would scroll widgets
75 * with it, and so the dock naturally frames
76 * it. Empty on first render — JS (`WidgetLayer`)
77 * populates it on boot.
78 */
79 ?>
80 <aside id="os-widgets" class="os-widgets" aria-label="<?php esc_attr_e( 'Widgets', 'desktop-mode' ); ?>"></aside>
81 </div>
82 </div>
83 </div>
84 <?php
85 /**
86 * Fires right after the desktop shell markup has rendered.
87 */
88 do_action( 'openstation_shell_after' );
89 }
90 add_action( 'in_admin_header', 'openstation_render_shell', 5 );
91
92