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/extended-options.php +53 -32 0.9.81.1.10 View file →
@@ -1,13 +1,16 @@
1 1 <?php
2 2 /**
3 - * Desktop Mode — Platform-wide extended options.
3 + * OpenStation — Platform-wide extended options.
4 4 *
5 5 * System-level toggles that enhance the WordPress admin with extra
6 - * desktop-mode capabilities. Stored in `wp_options` (not per-user) so
6 + * openstation capabilities. Stored in `wp_options` (not per-user) so
7 7 * they affect every user on the site. Admin-only to read or write.
8 8 *
9 9 * Current options:
10 + * - window_prewarm: preload windows on hover. Defaults to true.
11 + * - admin_asset_cache: share cached admin assets across windows.
12 + * Defaults to true. Both performance options apply on shell reload.
10 13 * - media_library_enhanced: when true, enqueues a small JS shim on
11 14 * every admin page that makes Media Library .attachment tiles
12 15 * draggable — users can drag images out of the library into any
13 16 * drop target (text fields, TinyMCE/Gutenberg blocks, custom
@@ -21,23 +24,38 @@
21 24 * `false`** — games are opt-IN; an admin turns them on in
22 25 * OS Settings → Features → Extended options. While off,
23 26 * `includes/games/bootstrap.php` skips every module file, so the
24 27 * framework consumes no resources at all (see
25 - * `desktop_mode_games_enabled()`).
28 + * `openstation_games_enabled()`).
26 29 * - agents: when true, the AI Agents framework loads — synthetic
27 30 * agent users, the `/desktop-mode/v1/agents` REST surface, the
28 31 * Agents section in My WordPress, and the Agent chat window.
29 32 * **Defaults to `false`** — agents are opt-IN. While off,
30 33 * `includes/agents/bootstrap.php` skips every module file (see
31 - * `desktop_mode_agents_enabled()`).
34 + * `openstation_agents_enabled()`).
35 + * - network: when true, the OpenStation Network module loads — the
36 + * keypair, the identity and list routes, the registry, the Network
37 + * window, and the hop token that logs a user in on arrival at
38 + * another install. **Defaults to `false`** — the network is
39 + * opt-IN. While off, `includes/network/bootstrap.php` skips every
40 + * module file (see `openstation_network_enabled()`), and a
41 + * multisite keeps the site switcher it has on its own.
32 42 *
33 - * @package WPDesktopMode
43 + * @package OpenStation
34 44 */
35 45
36 46 defined( 'ABSPATH' ) || exit;
37 47
38 -/** wp_options key for the extended options bundle. */
39 -const DESKTOP_MODE_EXTENDED_OPTIONS_KEY = 'desktop_mode_extended_options';
48 +/**
49 + * The `wp_options` key for the extended options bundle.
50 + *
51 + * The VALUE keeps its pre-rebrand spelling on purpose: it is a
52 + * persisted or externally-visible identifier, so renaming it would
53 + * orphan data already written by live installs (or break a live
54 + * URL). The mismatch between this constant's name and its value is
55 + * deliberate — it is NOT a half-finished rename.
56 + */
57 +const OPENSTATION_EXTENDED_OPTIONS_KEY = 'desktop_mode_extended_options';
40 58
41 59 // ---------------------------------------------------------------------------
42 60 // Get / save
43 61 // ---------------------------------------------------------------------------
@@ -44,17 +62,20 @@
44 62
45 63 /**
46 64 * Returns the extended options with defaults filled in.
47 65 *
48 - * @return array{ media_library_enhanced: bool, games: bool, agents: bool }
66 + * @return array{ media_library_enhanced: bool, games: bool, agents: bool, network: bool, window_prewarm: bool, admin_asset_cache: bool }
49 67 */
50 -function desktop_mode_get_extended_options() {
68 +function openstation_get_extended_options() {
51 69 $defaults = array(
52 70 'media_library_enhanced' => true,
71 + 'window_prewarm' => true,
72 + 'admin_asset_cache' => true,
53 73 'games' => false,
54 74 'agents' => false,
75 + 'network' => false,
55 76 );
56 - $raw = get_option( DESKTOP_MODE_EXTENDED_OPTIONS_KEY, array() );
77 + $raw = get_option( OPENSTATION_EXTENDED_OPTIONS_KEY, array() );
57 78 if ( ! is_array( $raw ) ) {
58 79 return $defaults;
59 80 }
60 81 // Fall back to the default only when the key is ABSENT — so an
@@ -75,21 +96,21 @@
75 96 *
76 97 * @param mixed $raw Incoming payload.
77 98 * @return bool
78 99 */
79 -function desktop_mode_save_extended_options( $raw ) {
100 +function openstation_save_extended_options( $raw ) {
80 101 if ( ! is_array( $raw ) ) {
81 102 return false;
82 103 }
83 104 // Merge over the current values so a payload that omits a key (an
84 105 // older client, a partial save) can't silently reset it.
85 - $clean = desktop_mode_get_extended_options();
106 + $clean = openstation_get_extended_options();
86 107 foreach ( $clean as $key => $current ) {
87 108 if ( array_key_exists( $key, $raw ) ) {
88 109 $clean[ $key ] = ! empty( $raw[ $key ] );
89 110 }
90 111 }
91 - return update_option( DESKTOP_MODE_EXTENDED_OPTIONS_KEY, $clean, false );
112 + return update_option( OPENSTATION_EXTENDED_OPTIONS_KEY, $clean, false );
92 113 }
93 114
94 115 // ---------------------------------------------------------------------------
95 116 // REST endpoint — admin only
@@ -97,9 +118,9 @@
97 118
98 119 /**
99 120 * Registers the extended options REST route.
100 121 */
101 -function desktop_mode_register_extended_options_rest_routes() {
122 +function openstation_register_extended_options_rest_routes() {
102 123 register_rest_route(
103 124 'desktop-mode/v1',
104 125 '/extended-options',
105 126 array(
@@ -104,15 +125,15 @@
104 125 '/extended-options',
105 126 array(
106 127 array(
107 128 'methods' => WP_REST_Server::READABLE,
108 - 'callback' => 'desktop_mode_rest_get_extended_options',
109 - 'permission_callback' => 'desktop_mode_rest_extended_options_permission',
129 + 'callback' => 'openstation_rest_get_extended_options',
130 + 'permission_callback' => 'openstation_rest_extended_options_permission',
110 131 ),
111 132 array(
112 133 'methods' => WP_REST_Server::CREATABLE,
113 - 'callback' => 'desktop_mode_rest_save_extended_options',
114 - 'permission_callback' => 'desktop_mode_rest_extended_options_permission',
134 + 'callback' => 'openstation_rest_save_extended_options',
135 + 'permission_callback' => 'openstation_rest_extended_options_permission',
115 136 'args' => array(
116 137 'options' => array(
117 138 'required' => true,
118 139 'type' => 'object',
@@ -121,9 +142,9 @@
121 142 ),
122 143 )
123 144 );
124 145 }
125 -add_action( 'rest_api_init', 'desktop_mode_register_extended_options_rest_routes' );
146 +add_action( 'rest_api_init', 'openstation_register_extended_options_rest_routes' );
126 147
127 148 /**
128 149 * Permission: admins only.
129 150 *
@@ -128,12 +149,12 @@
128 149 * Permission: admins only.
129 150 *
130 151 * @return bool|WP_Error
131 152 */
132 -function desktop_mode_rest_extended_options_permission() {
153 +function openstation_rest_extended_options_permission() {
133 154 if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
134 155 return new WP_Error(
135 - 'desktop_mode_extended_forbidden',
156 + 'openstation_extended_forbidden',
136 157 'Only administrators can manage extended options.',
137 158 array( 'status' => 403 )
138 159 );
139 160 }
@@ -144,10 +165,10 @@
144 165 * GET /desktop-mode/v1/extended-options
145 166 *
146 167 * @return WP_REST_Response
147 168 */
148 -function desktop_mode_rest_get_extended_options() {
149 - return rest_ensure_response( desktop_mode_get_extended_options() );
169 +function openstation_rest_get_extended_options() {
170 + return rest_ensure_response( openstation_get_extended_options() );
150 171 }
151 172
152 173 /**
153 174 * POST /desktop-mode/v1/extended-options
@@ -154,12 +175,12 @@
154 175 *
155 176 * @param WP_REST_Request $request
156 177 * @return WP_REST_Response
157 178 */
158 -function desktop_mode_rest_save_extended_options( WP_REST_Request $request ) {
179 +function openstation_rest_save_extended_options( WP_REST_Request $request ) {
159 180 $payload = $request->get_param( 'options' );
160 - desktop_mode_save_extended_options( $payload );
161 - return rest_ensure_response( desktop_mode_get_extended_options() );
181 + openstation_save_extended_options( $payload );
182 + return rest_ensure_response( openstation_get_extended_options() );
162 183 }
163 184
164 185 // ---------------------------------------------------------------------------
165 186 // Media Library enhancement enqueue
@@ -170,23 +191,23 @@
170 191 * toggled it on. The script is a no-op on pages where wp.media isn't
171 192 * loaded (it checks at runtime), so there's no harm in enqueuing
172 193 * globally in the admin.
173 194 */
174 -function desktop_mode_enqueue_media_library_enhancement() {
195 +function openstation_enqueue_media_library_enhancement() {
175 196 if ( ! is_admin() || ! is_user_logged_in() ) {
176 197 return;
177 198 }
178 199
179 - $options = desktop_mode_get_extended_options();
200 + $options = openstation_get_extended_options();
180 201 if ( empty( $options['media_library_enhanced'] ) ) {
181 202 return;
182 203 }
183 204
184 205 wp_enqueue_script(
185 - 'desktop-mode-media-library-enhanced',
186 - DESKTOP_MODE_URL . 'assets/js/media-library-enhanced.js',
206 + 'os-media-library-enhanced',
207 + OPENSTATION_URL . 'assets/js/media-library-enhanced.js',
187 208 array(),
188 - DESKTOP_MODE_VERSION,
209 + OPENSTATION_VERSION,
189 210 true
190 211 );
191 212 }
192 -add_action( 'admin_enqueue_scripts', 'desktop_mode_enqueue_media_library_enhancement', 20 );
213 +add_action( 'admin_enqueue_scripts', 'openstation_enqueue_media_library_enhancement', 20 );