PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.12
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.12
1.1.12 1.1.11 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 All 36 releases
← All changes | includes/extended-options.php +59 -45 0.9.7 → 1.1.12 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,17 +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()`).
29 + * - agents: when true, the AI Agents framework loads — synthetic
30 + * agent users, the `/desktop-mode/v1/agents` REST surface, the
31 + * Agents section in My WordPress, and the Agent chat window.
32 + * **Defaults to `false`** — agents are opt-IN. While off,
33 + * `includes/agents/bootstrap.php` skips every module file (see
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.
26 42 *
27 - * @package WPDesktopMode
43 + * @package OpenStation
28 44 */
29 45
30 46 defined( 'ABSPATH' ) || exit;
31 47
32 -/** wp_options key for the extended options bundle. */
33 -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';
34 58
35 59 // ---------------------------------------------------------------------------
36 60 // Get / save
37 61 // ---------------------------------------------------------------------------
@@ -38,18 +62,20 @@
38 62
39 63 /**
40 64 * Returns the extended options with defaults filled in.
41 65 *
42 - * @since 0.5.0
43 - *
44 - * @return array{ media_library_enhanced: bool, games: bool }
66 + * @return array{ media_library_enhanced: bool, games: bool, agents: bool, network: bool, window_prewarm: bool, admin_asset_cache: bool }
45 67 */
46 -function desktop_mode_get_extended_options() {
68 +function openstation_get_extended_options() {
47 69 $defaults = array(
48 70 'media_library_enhanced' => true,
71 + 'window_prewarm' => true,
72 + 'admin_asset_cache' => true,
49 73 'games' => false,
74 + 'agents' => false,
75 + 'network' => false,
50 76 );
51 - $raw = get_option( DESKTOP_MODE_EXTENDED_OPTIONS_KEY, array() );
77 + $raw = get_option( OPENSTATION_EXTENDED_OPTIONS_KEY, array() );
52 78 if ( ! is_array( $raw ) ) {
53 79 return $defaults;
54 80 }
55 81 // Fall back to the default only when the key is ABSENT — so an
@@ -67,26 +93,24 @@
67 93
68 94 /**
69 95 * Persists extended options to `wp_options`.
70 96 *
71 - * @since 0.5.0
72 - *
73 97 * @param mixed $raw Incoming payload.
74 98 * @return bool
75 99 */
76 -function desktop_mode_save_extended_options( $raw ) {
100 +function openstation_save_extended_options( $raw ) {
77 101 if ( ! is_array( $raw ) ) {
78 102 return false;
79 103 }
80 104 // Merge over the current values so a payload that omits a key (an
81 105 // older client, a partial save) can't silently reset it.
82 - $clean = desktop_mode_get_extended_options();
106 + $clean = openstation_get_extended_options();
83 107 foreach ( $clean as $key => $current ) {
84 108 if ( array_key_exists( $key, $raw ) ) {
85 109 $clean[ $key ] = ! empty( $raw[ $key ] );
86 110 }
87 111 }
88 - return update_option( DESKTOP_MODE_EXTENDED_OPTIONS_KEY, $clean, false );
112 + return update_option( OPENSTATION_EXTENDED_OPTIONS_KEY, $clean, false );
89 113 }
90 114
91 115 // ---------------------------------------------------------------------------
92 116 // REST endpoint — admin only
@@ -93,12 +117,10 @@
93 117 // ---------------------------------------------------------------------------
94 118
95 119 /**
96 120 * Registers the extended options REST route.
97 - *
98 - * @since 0.5.0
99 121 */
100 -function desktop_mode_register_extended_options_rest_routes() {
122 +function openstation_register_extended_options_rest_routes() {
101 123 register_rest_route(
102 124 'desktop-mode/v1',
103 125 '/extended-options',
104 126 array(
@@ -103,15 +125,15 @@
103 125 '/extended-options',
104 126 array(
105 127 array(
106 128 'methods' => WP_REST_Server::READABLE,
107 - 'callback' => 'desktop_mode_rest_get_extended_options',
108 - 'permission_callback' => 'desktop_mode_rest_extended_options_permission',
129 + 'callback' => 'openstation_rest_get_extended_options',
130 + 'permission_callback' => 'openstation_rest_extended_options_permission',
109 131 ),
110 132 array(
111 133 'methods' => WP_REST_Server::CREATABLE,
112 - 'callback' => 'desktop_mode_rest_save_extended_options',
113 - 'permission_callback' => 'desktop_mode_rest_extended_options_permission',
134 + 'callback' => 'openstation_rest_save_extended_options',
135 + 'permission_callback' => 'openstation_rest_extended_options_permission',
114 136 'args' => array(
115 137 'options' => array(
116 138 'required' => true,
117 139 'type' => 'object',
@@ -120,21 +142,19 @@
120 142 ),
121 143 )
122 144 );
123 145 }
124 -add_action( 'rest_api_init', 'desktop_mode_register_extended_options_rest_routes' );
146 +add_action( 'rest_api_init', 'openstation_register_extended_options_rest_routes' );
125 147
126 148 /**
127 149 * Permission: admins only.
128 150 *
129 - * @since 0.5.0
130 - *
131 151 * @return bool|WP_Error
132 152 */
133 -function desktop_mode_rest_extended_options_permission() {
153 +function openstation_rest_extended_options_permission() {
134 154 if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
135 155 return new WP_Error(
136 - 'desktop_mode_extended_forbidden',
156 + 'openstation_extended_forbidden',
137 157 'Only administrators can manage extended options.',
138 158 array( 'status' => 403 )
139 159 );
140 160 }
@@ -143,28 +163,24 @@
143 163
144 164 /**
145 165 * GET /desktop-mode/v1/extended-options
146 166 *
147 - * @since 0.5.0
148 - *
149 167 * @return WP_REST_Response
150 168 */
151 -function desktop_mode_rest_get_extended_options() {
152 - 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() );
153 171 }
154 172
155 173 /**
156 174 * POST /desktop-mode/v1/extended-options
157 175 *
158 - * @since 0.5.0
159 - *
160 176 * @param WP_REST_Request $request
161 177 * @return WP_REST_Response
162 178 */
163 -function desktop_mode_rest_save_extended_options( WP_REST_Request $request ) {
179 +function openstation_rest_save_extended_options( WP_REST_Request $request ) {
164 180 $payload = $request->get_param( 'options' );
165 - desktop_mode_save_extended_options( $payload );
166 - return rest_ensure_response( desktop_mode_get_extended_options() );
181 + openstation_save_extended_options( $payload );
182 + return rest_ensure_response( openstation_get_extended_options() );
167 183 }
168 184
169 185 // ---------------------------------------------------------------------------
170 186 // Media Library enhancement enqueue
@@ -174,26 +190,24 @@
174 190 * Enqueues the media-library enhancement shim when the admin has
175 191 * toggled it on. The script is a no-op on pages where wp.media isn't
176 192 * loaded (it checks at runtime), so there's no harm in enqueuing
177 193 * globally in the admin.
178 - *
179 - * @since 0.5.0
180 194 */
181 -function desktop_mode_enqueue_media_library_enhancement() {
195 +function openstation_enqueue_media_library_enhancement() {
182 196 if ( ! is_admin() || ! is_user_logged_in() ) {
183 197 return;
184 198 }
185 199
186 - $options = desktop_mode_get_extended_options();
200 + $options = openstation_get_extended_options();
187 201 if ( empty( $options['media_library_enhanced'] ) ) {
188 202 return;
189 203 }
190 204
191 205 wp_enqueue_script(
192 - 'desktop-mode-media-library-enhanced',
193 - DESKTOP_MODE_URL . 'assets/js/media-library-enhanced.js',
206 + 'os-media-library-enhanced',
207 + OPENSTATION_URL . 'assets/js/media-library-enhanced.js',
194 208 array(),
195 - DESKTOP_MODE_VERSION,
209 + OPENSTATION_VERSION,
196 210 true
197 211 );
198 212 }
199 -add_action( 'admin_enqueue_scripts', 'desktop_mode_enqueue_media_library_enhancement', 20 );
213 +add_action( 'admin_enqueue_scripts', 'openstation_enqueue_media_library_enhancement', 20 );