PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.10
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.10
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
← All changes | includes/render/body-classes.php +42 -7 1.1.21.1.10 View file →
@@ -31,15 +31,13 @@
31 31 if ( openstation_is_chromeless_request() ) {
32 32 return ltrim( $classes . ' os-chromeless' );
33 33 }
34 34
35 - // Per-request classic override: don't tag the body as desktop-active so
36 - // the classic chrome isn't hidden by CSS for this one tab.
37 - if ( openstation_is_classic_request() ) {
38 - return $classes;
39 - }
40 -
41 - if ( openstation_is_enabled() ) {
35 + // `os-active` hides the classic chrome, so it belongs only to a
36 + // request that paints the shell: the shell screen, or a solo boot.
37 + // A classic-flagged request, and a plain admin page reached with
38 + // the portal redirect disabled, keep their chrome.
39 + if ( openstation_is_shell_request() ) {
42 40 $classes = ltrim(
43 41 $classes . ' os-active os-admin-bar-'
44 42 . openstation_get_admin_bar_mode()
45 43 );
@@ -91,6 +89,43 @@
91 89 // anyway. `static` is the safe landing — it is the only mode
92 90 // that can't hide the user's way out of the shell.
93 91 return is_string( $mode ) && in_array( $mode, OPENSTATION_OS_SETTINGS_ADMIN_BAR_MODES, true )
94 92 ? $mode
93 + : 'static';
94 +}
95 +
96 +/**
97 + * Resolves the current user's behavior for the dock — the single rail
98 + * in the Unified layout, the bottom dock in Split. (The Split sidebar
99 + * has its own `sideDockBehavior`, but it is synthesised by JS and
100 + * needs no first-paint answer from PHP.)
101 + *
102 + * Emitted as `data-os-dock-behavior` on `#os-dock` by the shell
103 + * template so the very first paint already folds (or doesn't) the
104 + * rail — the shell's JS apply pass re-writes the same attribute on
105 + * every settings change, but it runs after the dock has painted,
106 + * which would flash a rail the user asked to keep out of the way.
107 + *
108 + * @return string One of `static`, `dynamic`.
109 + */
110 +function openstation_get_dock_behavior() {
111 + $settings = openstation_get_os_settings( get_current_user_id() );
112 + $behavior = isset( $settings['dockBehavior'] ) ? (string) $settings['dockBehavior'] : 'static';
113 +
114 + /**
115 + * Filters the dock behavior for the current request.
116 + *
117 + * Lets a plugin pin the behavior regardless of the user's own
118 + * OpenStation Preferences pick — keeping the rail always on
119 + * screen for users who would otherwise not find it, say.
120 + *
121 + * @param string $behavior One of `static`, `dynamic`.
122 + */
123 + $behavior = apply_filters( 'openstation_dock_behavior', $behavior );
124 +
125 + // Fails closed, same as the admin-bar mode: `static` is the one
126 + // behavior that can't hide the rail from a user who doesn't know
127 + // where to point.
128 + return is_string( $behavior ) && in_array( $behavior, OPENSTATION_OS_SETTINGS_DOCK_BEHAVIORS, true )
129 + ? $behavior
95 130 : 'static';
96 131 }