PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.13
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.13
1.1.13 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 All 37 releases
← All changes | includes/os-settings.php +56 -4 1.1.8 → 1.1.13 View file →
@@ -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,
@@ -253,8 +264,10 @@
253 264 // the wallpaper, settles onto nearby windows, and watches the
254 265 // pointer. Off by default; toggled from the wallpaper context
255 266 // menu. Per-user. See `docs/mio.md`.
256 267 'mioEnabled' => false,
268 + 'mioApiEnabled' => false,
269 + 'mioShowOnWallpaper' => true,
257 270 // The user's own Mio, as built in "Make it yours": partial
258 271 // appearance + silhouette overrides, both empty until they
259 272 // touch a control. Stored per user rather than per browser
260 273 // because it is a preference about the person — ten minutes
@@ -448,11 +461,17 @@
448 461 }
449 462
450 463 // Wallpaper — any non-empty string; registry membership is validated
451 464 // client-side at apply time.
452 - $wallpaper = isset( $raw['wallpaper'] ) && is_string( $raw['wallpaper'] ) && '' !== $raw['wallpaper']
453 - ? sanitize_key( $raw['wallpaper'] )
454 - : $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 + }
455 474
456 475 // Accent — non-empty string; swatch validity is enforced in the picker.
457 476 $accent = isset( $raw['accent'] ) && is_string( $raw['accent'] ) && '' !== $raw['accent']
458 477 ? sanitize_key( $raw['accent'] )
@@ -477,8 +496,13 @@
477 496 $window_radius = isset( $raw['windowRadius'] ) && in_array( $raw['windowRadius'], OPENSTATION_OS_SETTINGS_WINDOW_RADII, true )
478 497 ? (string) $raw['windowRadius']
479 498 : $defaults['windowRadius'];
480 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 +
481 505 // Admin-bar mode — must be one of the three known values.
482 506 $admin_bar_mode = isset( $raw['adminBarMode'] )
483 507 && in_array( $raw['adminBarMode'], OPENSTATION_OS_SETTINGS_ADMIN_BAR_MODES, true )
484 508 ? (string) $raw['adminBarMode']
@@ -776,8 +800,27 @@
776 800 // user meta indefinitely.
777 801 $native_posts_hidden_columns = array_slice( array_values( array_unique( $native_posts_hidden_columns ) ), 0, 32 );
778 802 }
779 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 +
780 823 $native_pages_enabled = isset( $raw['nativePagesEnabled'] )
781 824 ? (bool) $raw['nativePagesEnabled']
782 825 : $defaults['nativePagesEnabled'];
783 826
@@ -812,9 +855,9 @@
812 855 : $defaults['confirmCloseAllWindows'];
813 856
814 857 $mio_enabled = isset( $raw['mioEnabled'] )
815 858 ? (bool) $raw['mioEnabled']
816 - : $defaults['mioEnabled'];
859 + : ( isset( $raw['mioApiEnabled'] ) ? (bool) $raw['mioApiEnabled'] : $defaults['mioEnabled'] );
817 860
818 861 // A missing key means "no look saved yet", which sanitizes to the
819 862 // same pair of empty arrays the defaults carry — so this needs no
820 863 // isset() branch of its own.
@@ -975,8 +1018,9 @@
975 1018 'accent' => $accent,
976 1019 'customAccent' => $custom_accent,
977 1020 'dockSize' => $dock_size,
978 1021 'windowRadius' => $window_radius,
1022 + 'openWindowsAs' => $open_windows_as,
979 1023 'adminBarMode' => $admin_bar_mode,
980 1024 'desktopLayout' => $desktop_layout,
981 1025 'dockPlacement' => $dock_placement,
982 1026 'dockBehavior' => $dock_behavior,
@@ -1000,8 +1044,9 @@
1000 1044 'heartbeatRate' => $heartbeat_rate,
1001 1045 'nativePostsEnabled' => $native_posts_enabled,
1002 1046 'nativePostsHiddenColumns' => $native_posts_hidden_columns,
1003 1047 'nativePagesEnabled' => $native_pages_enabled,
1048 + 'nativePagesHiddenColumns' => $native_pages_hidden_columns,
1004 1049 'nativeUsersEnabled' => $native_users_enabled,
1005 1050 'nativePluginsEnabled' => $native_plugins_enabled,
1006 1051 'nativeCommentsEnabled' => $native_comments_enabled,
1007 1052 'stationHomeEnabled' => $station_home_enabled,
@@ -1009,8 +1054,10 @@
1009 1054 'windowPrewarmEnabled' => $window_prewarm_enabled,
1010 1055 'showDesktopOnWallpaperClick' => $show_desktop_on_wallpaper_click,
1011 1056 'confirmCloseAllWindows' => $confirm_close_all_windows,
1012 1057 'mioEnabled' => $mio_enabled,
1058 + 'mioApiEnabled' => $mio_enabled,
1059 + 'mioShowOnWallpaper' => isset( $raw['mioShowOnWallpaper'] ) ? (bool) $raw['mioShowOnWallpaper'] : $defaults['mioShowOnWallpaper'],
1013 1060 'mioStyle' => $mio_style,
1014 1061 'showPostStatusRibbons' => $show_post_status_ribbons,
1015 1062 'developerModeEnabled' => $developer_mode_enabled,
1016 1063 'foldersSharingEnabled' => $folders_sharing_enabled,
@@ -1118,8 +1165,13 @@
1118 1165 // true of every path into this handler, not just the ones the
1119 1166 // schema happens to guard.
1120 1167 if ( ! is_array( $payload ) ) {
1121 1168 return rest_ensure_response( openstation_get_os_settings( $user_id ) );
1169 + }
1170 +
1171 + // Normalize an alias-only patch before merging it with the saved master value.
1172 + if ( ! array_key_exists( 'mioEnabled', $payload ) && array_key_exists( 'mioApiEnabled', $payload ) ) {
1173 + $payload['mioEnabled'] = $payload['mioApiEnabled'];
1122 1174 }
1123 1175
1124 1176 openstation_save_os_settings(
1125 1177 $user_id,