PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.5
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.5
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.1.5, at includes/render/shell.php

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