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/chromeless-bridge.php +31 -2 1.1.51.1.10 View file →
@@ -327,11 +327,13 @@
327 327 // `admin.php` calls `set_current_screen()` AFTER `admin_init`,
328 328 // so at probe time there is no screen yet — and Core's own
329 329 // enqueue callbacks (the block-editor script loader among
330 330 // them) read `get_current_screen()->id` unguarded. Build the
331 - // screen the real flow would have had before the hook fires.
331 + // screen the real flow would have had before the hook fires,
332 + // in the request's own admin context — see
333 + // `openstation_menu_refresh_probe_screen_id()`.
332 334 if ( function_exists( 'set_current_screen' ) && function_exists( 'get_current_screen' ) && ! get_current_screen() ) {
333 - set_current_screen( 'admin' );
335 + set_current_screen( openstation_menu_refresh_probe_screen_id() );
334 336 }
335 337 ob_start();
336 338 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- deliberate replay of Core's own hook so handle-attached script data exists before the harvest below.
337 339 do_action( 'admin_enqueue_scripts', 'admin.php' );
@@ -338,8 +340,35 @@
338 340 ob_end_clean();
339 341 }
340 342
341 343 return openstation_build_menu_payload();
344 +}
345 +
346 +/**
347 + * The screen id the refresh probe builds its placeholder `WP_Screen`
348 + * from: `admin-network` in the network admin, `admin-user` in the user
349 + * admin, `admin` on a site.
350 + *
351 + * Once a screen exists, `is_network_admin()` answers from it — and a
352 + * screen built from a bare id gets its admin context from the id's
353 + * SUFFIX (`-network`, `-user`, or none for a site screen), never from
354 + * `WP_NETWORK_ADMIN`. A plain `admin` screen therefore turned a
355 + * network-admin probe into a site request for everything after it:
356 + * `self_admin_url()` resolved every network menu slug against the site
357 + * admin, and a live refresh on the network shell painted a dock whose
358 + * tiles opened site pages. Read the context here, BEFORE any screen
359 + * exists, where the answer still comes from the request itself.
360 + *
361 + * @return string Screen id carrying the request's admin context.
362 + */
363 +function openstation_menu_refresh_probe_screen_id() {
364 + if ( is_network_admin() ) {
365 + return 'admin-network';
366 + }
367 + if ( is_user_admin() ) {
368 + return 'admin-user';
369 + }
370 + return 'admin';
342 371 }
343 372
344 373 /**
345 374 * Outputs the chromeless screen-meta bridge script.