| @@ -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 |
| @@ -93,8 +96,10 @@ | ||
| 93 | 96 | */ |
| 94 | 97 | function openstation_default_os_settings() { |
| 95 | 98 | return array( |
| 96 | 99 | 'wallpaper' => 'galaxy', |
| 100 | + // Pulse, the brand's signature. Mirrors `DEFAULTS` in | |
| 101 | + // `src/settings/constants.ts`. | |
| 97 | 102 | 'accent' => 'pulse', |
| 98 | 103 | // Only read when `accent` is `custom`. Seeded with Pulse so |
| 99 | 104 | // picking Custom before touching the wheel is a no-op rather |
| 100 | 105 | // than a jump to black. Mirrors `DEFAULTS` in |
| @@ -108,8 +113,9 @@ | ||
| 108 | 113 | // `src/settings/constants.ts` — PHP seeds the first load and JS |
| 109 | 114 | // owns every paint after it, so a mismatch shows up as the |
| 110 | 115 | // corners changing shape a moment after the shell boots. |
| 111 | 116 | 'windowRadius' => 'round', |
| 117 | + 'openWindowsAs' => 'default', | |
| 112 | 118 | // How the WordPress admin bar presents above the shell. |
| 113 | 119 | // `hidden` ships as the default so a fresh desktop has ONE |
| 114 | 120 | // navigation surface: everything the user can open lives on the |
| 115 | 121 | // dock, and the dock's "Exit OpenStation" tile is the way back |
| @@ -210,8 +216,13 @@ | ||
| 210 | 216 | // window (e.g. array( 'author', 'tags' )). Empty array means |
| 211 | 217 | // every column is visible. The sticky 'title' column is always |
| 212 | 218 | // shown — the UI prevents toggling it. |
| 213 | 219 | 'nativePostsHiddenColumns' => array(), |
| 220 | + // Per-user list of column keys hidden in the native Pages | |
| 221 | + // window (e.g. array( 'author', 'parent' )). Empty array means | |
| 222 | + // every column is visible. The sticky 'title' column is always | |
| 223 | + // shown — the UI prevents toggling it. | |
| 224 | + 'nativePagesHiddenColumns' => array(), | |
| 214 | 225 | // Per-user opt-IN for the native Pages window. Same posture as |
| 215 | 226 | // nativePostsEnabled — defaults OFF (Beta), users opt in to swap |
| 216 | 227 | // the classic `edit.php?post_type=page` iframe for the native UI. |
| 217 | 228 | 'nativePagesEnabled' => false, |
| @@ -450,11 +461,17 @@ | ||
| 450 | 461 | } |
| 451 | 462 | |
| 452 | 463 | // Wallpaper — any non-empty string; registry membership is validated |
| 453 | 464 | // client-side at apply time. |
| 454 | - $wallpaper = isset( $raw['wallpaper'] ) && is_string( $raw['wallpaper'] ) && '' !== $raw['wallpaper'] | |
| 455 | - ? sanitize_key( $raw['wallpaper'] ) | |
| 456 | - : $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 | + } | |
| 457 | 474 | |
| 458 | 475 | // Accent — non-empty string; swatch validity is enforced in the picker. |
| 459 | 476 | $accent = isset( $raw['accent'] ) && is_string( $raw['accent'] ) && '' !== $raw['accent'] |
| 460 | 477 | ? sanitize_key( $raw['accent'] ) |
| @@ -479,8 +496,13 @@ | ||
| 479 | 496 | $window_radius = isset( $raw['windowRadius'] ) && in_array( $raw['windowRadius'], OPENSTATION_OS_SETTINGS_WINDOW_RADII, true ) |
| 480 | 497 | ? (string) $raw['windowRadius'] |
| 481 | 498 | : $defaults['windowRadius']; |
| 482 | 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 | + | |
| 483 | 505 | // Admin-bar mode — must be one of the three known values. |
| 484 | 506 | $admin_bar_mode = isset( $raw['adminBarMode'] ) |
| 485 | 507 | && in_array( $raw['adminBarMode'], OPENSTATION_OS_SETTINGS_ADMIN_BAR_MODES, true ) |
| 486 | 508 | ? (string) $raw['adminBarMode'] |
| @@ -778,8 +800,27 @@ | ||
| 778 | 800 | // user meta indefinitely. |
| 779 | 801 | $native_posts_hidden_columns = array_slice( array_values( array_unique( $native_posts_hidden_columns ) ), 0, 32 ); |
| 780 | 802 | } |
| 781 | 803 | |
| 804 | + $native_pages_hidden_columns = $defaults['nativePagesHiddenColumns']; | |
| 805 | + if ( isset( $raw['nativePagesHiddenColumns'] ) && is_array( $raw['nativePagesHiddenColumns'] ) ) { | |
| 806 | + $native_pages_hidden_columns = array(); | |
| 807 | + foreach ( $raw['nativePagesHiddenColumns'] as $col ) { | |
| 808 | + if ( ! is_string( $col ) || '' === $col ) { | |
| 809 | + continue; | |
| 810 | + } | |
| 811 | + $slug = sanitize_key( $col ); | |
| 812 | + if ( '' === $slug ) { | |
| 813 | + continue; | |
| 814 | + } | |
| 815 | + $native_pages_hidden_columns[] = $slug; | |
| 816 | + } | |
| 817 | + // Cap to a sane upper bound — far more than any plausible | |
| 818 | + // column count, but blocks a malicious payload from bloating | |
| 819 | + // user meta indefinitely. | |
| 820 | + $native_pages_hidden_columns = array_slice( array_values( array_unique( $native_pages_hidden_columns ) ), 0, 32 ); | |
| 821 | + } | |
| 822 | + | |
| 782 | 823 | $native_pages_enabled = isset( $raw['nativePagesEnabled'] ) |
| 783 | 824 | ? (bool) $raw['nativePagesEnabled'] |
| 784 | 825 | : $defaults['nativePagesEnabled']; |
| 785 | 826 | |
| @@ -977,8 +1018,9 @@ | ||
| 977 | 1018 | 'accent' => $accent, |
| 978 | 1019 | 'customAccent' => $custom_accent, |
| 979 | 1020 | 'dockSize' => $dock_size, |
| 980 | 1021 | 'windowRadius' => $window_radius, |
| 1022 | + 'openWindowsAs' => $open_windows_as, | |
| 981 | 1023 | 'adminBarMode' => $admin_bar_mode, |
| 982 | 1024 | 'desktopLayout' => $desktop_layout, |
| 983 | 1025 | 'dockPlacement' => $dock_placement, |
| 984 | 1026 | 'dockBehavior' => $dock_behavior, |
| @@ -1002,8 +1044,9 @@ | ||
| 1002 | 1044 | 'heartbeatRate' => $heartbeat_rate, |
| 1003 | 1045 | 'nativePostsEnabled' => $native_posts_enabled, |
| 1004 | 1046 | 'nativePostsHiddenColumns' => $native_posts_hidden_columns, |
| 1005 | 1047 | 'nativePagesEnabled' => $native_pages_enabled, |
| 1048 | + 'nativePagesHiddenColumns' => $native_pages_hidden_columns, | |
| 1006 | 1049 | 'nativeUsersEnabled' => $native_users_enabled, |
| 1007 | 1050 | 'nativePluginsEnabled' => $native_plugins_enabled, |
| 1008 | 1051 | 'nativeCommentsEnabled' => $native_comments_enabled, |
| 1009 | 1052 | 'stationHomeEnabled' => $station_home_enabled, |