| @@ -30,8 +30,11 @@ | ||
| 30 | 30 | |
| 31 | 31 | /** Valid window-radius IDs — mirrors the TS `WINDOW_RADII` constant. */ |
| 32 | 32 | const OPENSTATION_OS_SETTINGS_WINDOW_RADII = array( 'sharp', 'default', 'round' ); |
| 33 | 33 | |
| 34 | +/** How a newly opened window lands — mirrors the TS `OPEN_WINDOWS_AS` constant. */ | |
| 35 | +const OPENSTATION_OS_SETTINGS_OPEN_WINDOWS_AS = array( 'default', 'maximized', 'focused' ); | |
| 36 | + | |
| 34 | 37 | /** |
| 35 | 38 | * Valid admin-bar mode IDs — mirrors the TS `ADMIN_BAR_MODES` constant. |
| 36 | 39 | * |
| 37 | 40 | * `static` keeps the WordPress admin bar pinned above the shell (the |
| @@ -110,8 +113,9 @@ | ||
| 110 | 113 | // `src/settings/constants.ts` — PHP seeds the first load and JS |
| 111 | 114 | // owns every paint after it, so a mismatch shows up as the |
| 112 | 115 | // corners changing shape a moment after the shell boots. |
| 113 | 116 | 'windowRadius' => 'round', |
| 117 | + 'openWindowsAs' => 'default', | |
| 114 | 118 | // How the WordPress admin bar presents above the shell. |
| 115 | 119 | // `hidden` ships as the default so a fresh desktop has ONE |
| 116 | 120 | // navigation surface: everything the user can open lives on the |
| 117 | 121 | // dock, and the dock's "Exit OpenStation" tile is the way back |
| @@ -457,11 +461,17 @@ | ||
| 457 | 461 | } |
| 458 | 462 | |
| 459 | 463 | // Wallpaper — any non-empty string; registry membership is validated |
| 460 | 464 | // client-side at apply time. |
| 461 | - $wallpaper = isset( $raw['wallpaper'] ) && is_string( $raw['wallpaper'] ) && '' !== $raw['wallpaper'] | |
| 462 | - ? sanitize_key( $raw['wallpaper'] ) | |
| 463 | - : $defaults['wallpaper']; | |
| 465 | + // Key-clean per `/` segment: a desktop theme's wallpapers are | |
| 466 | + // registered as `desktop-theme/<theme>/<id>`, and a flat | |
| 467 | + // `sanitize_key()` would fold that into an id nothing answers to. | |
| 468 | + $wallpaper = isset( $raw['wallpaper'] ) && is_string( $raw['wallpaper'] ) | |
| 469 | + ? implode( '/', array_filter( array_map( 'sanitize_key', explode( '/', $raw['wallpaper'] ) ) ) ) | |
| 470 | + : ''; | |
| 471 | + if ( '' === $wallpaper ) { | |
| 472 | + $wallpaper = $defaults['wallpaper']; | |
| 473 | + } | |
| 464 | 474 | |
| 465 | 475 | // Accent — non-empty string; swatch validity is enforced in the picker. |
| 466 | 476 | $accent = isset( $raw['accent'] ) && is_string( $raw['accent'] ) && '' !== $raw['accent'] |
| 467 | 477 | ? sanitize_key( $raw['accent'] ) |
| @@ -486,8 +496,13 @@ | ||
| 486 | 496 | $window_radius = isset( $raw['windowRadius'] ) && in_array( $raw['windowRadius'], OPENSTATION_OS_SETTINGS_WINDOW_RADII, true ) |
| 487 | 497 | ? (string) $raw['windowRadius'] |
| 488 | 498 | : $defaults['windowRadius']; |
| 489 | 499 | |
| 500 | + // How a newly opened window lands — one of the three known values. | |
| 501 | + $open_windows_as = isset( $raw['openWindowsAs'] ) && in_array( $raw['openWindowsAs'], OPENSTATION_OS_SETTINGS_OPEN_WINDOWS_AS, true ) | |
| 502 | + ? (string) $raw['openWindowsAs'] | |
| 503 | + : $defaults['openWindowsAs']; | |
| 504 | + | |
| 490 | 505 | // Admin-bar mode — must be one of the three known values. |
| 491 | 506 | $admin_bar_mode = isset( $raw['adminBarMode'] ) |
| 492 | 507 | && in_array( $raw['adminBarMode'], OPENSTATION_OS_SETTINGS_ADMIN_BAR_MODES, true ) |
| 493 | 508 | ? (string) $raw['adminBarMode'] |
| @@ -1003,8 +1018,9 @@ | ||
| 1003 | 1018 | 'accent' => $accent, |
| 1004 | 1019 | 'customAccent' => $custom_accent, |
| 1005 | 1020 | 'dockSize' => $dock_size, |
| 1006 | 1021 | 'windowRadius' => $window_radius, |
| 1022 | + 'openWindowsAs' => $open_windows_as, | |
| 1007 | 1023 | 'adminBarMode' => $admin_bar_mode, |
| 1008 | 1024 | 'desktopLayout' => $desktop_layout, |
| 1009 | 1025 | 'dockPlacement' => $dock_placement, |
| 1010 | 1026 | 'dockBehavior' => $dock_behavior, |