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/notes/cpt.php +25 -27 0.9.81.1.10 View file →
@@ -1,18 +1,16 @@
1 1 <?php
2 2 /**
3 - * Desktop Mode — Pinned notes CPT.
3 + * OpenStation — Pinned notes CPT.
4 4 *
5 5 * Registers the `wpd_note` post type backing the pinned-notes feature:
6 - * paper notes the user writes in the Note Pad widget and pins to the
7 - * desktop wallpaper. Distinct from the Guidelines-backed sticky-notes
8 - * layer (`includes/sticky-notes/heartbeat.php`) — that one rides
9 - * Gutenberg's `wp_guideline` CPT; this one is plugin-owned.
6 + * paper notes the user writes in the Note Pad widget (or straight on
7 + * the wallpaper, via its right-click menu) and pins to the desktop.
10 8 *
11 9 * Visibility model: the "public" checkbox maps to `post_status`.
12 10 *
13 11 * 'private' — default; only the owner sees the note.
14 - * 'publish' — public; every desktop-mode user sees it (read-only
12 + * 'publish' — public; every openstation user sees it (read-only
15 13 * for non-owners). Nothing leaks outside the plugin's
16 14 * own REST controller because the CPT is not publicly
17 15 * queryable, excluded from search, and absent from the
18 16 * core REST API.
@@ -20,14 +18,14 @@
20 18 * Position (normalized 0–1 of the desktop area), paper color, and
21 19 * z-order live in postmeta — per-owner placement is the canonical
22 20 * placement every viewer sees.
23 21 *
24 - * @package WPDesktopMode
22 + * @package OpenStation
25 23 */
26 24
27 25 defined( 'ABSPATH' ) || exit;
28 26
29 -const DESKTOP_MODE_NOTES_POST_TYPE = 'wpd_note';
27 +const OPENSTATION_NOTES_POST_TYPE = 'wpd_note';
30 28
31 29 /**
32 30 * The pastel paper color slugs a note may use.
33 31 *
@@ -36,9 +34,9 @@
36 34 * by these slugs).
37 35 *
38 36 * @return string[] Color slugs.
39 37 */
40 -function desktop_mode_notes_colors() {
38 +function openstation_notes_colors() {
41 39 $colors = array( 'butter', 'blush', 'sky', 'mint', 'lilac', 'peach' );
42 40
43 41 /**
44 42 * Filters the allowed pinned-note paper colors.
@@ -49,9 +47,9 @@
49 47 * using them render with the fallback (butter) paper.
50 48 *
51 49 * @param string[] $colors Allowed color slugs.
52 50 */
53 - $colors = apply_filters( 'desktop_mode_notes_colors', $colors );
51 + $colors = apply_filters( 'openstation_notes_colors', $colors );
54 52
55 53 return array_values( array_filter( array_map( 'sanitize_key', (array) $colors ) ) );
56 54 }
57 55
@@ -57,11 +55,11 @@
57 55
58 56 /**
59 57 * Register the `wpd_note` post type + its meta.
60 58 */
61 -function desktop_mode_notes_register_cpt() {
59 +function openstation_notes_register_cpt() {
62 60 register_post_type(
63 - DESKTOP_MODE_NOTES_POST_TYPE,
61 + OPENSTATION_NOTES_POST_TYPE,
64 62 array(
65 63 'label' => __( 'Desktop Notes', 'desktop-mode' ),
66 64 'public' => false,
67 65 'publicly_queryable' => false,
@@ -78,42 +76,42 @@
78 76 )
79 77 );
80 78
81 79 register_post_meta(
82 - DESKTOP_MODE_NOTES_POST_TYPE,
80 + OPENSTATION_NOTES_POST_TYPE,
83 81 '_wpd_note_color',
84 82 array(
85 83 'type' => 'string',
86 84 'single' => true,
87 85 'default' => 'butter',
88 - 'sanitize_callback' => 'desktop_mode_notes_sanitize_color',
86 + 'sanitize_callback' => 'openstation_notes_sanitize_color',
89 87 )
90 88 );
91 89
92 90 register_post_meta(
93 - DESKTOP_MODE_NOTES_POST_TYPE,
91 + OPENSTATION_NOTES_POST_TYPE,
94 92 '_wpd_note_x',
95 93 array(
96 94 'type' => 'number',
97 95 'single' => true,
98 96 'default' => 0.1,
99 - 'sanitize_callback' => 'desktop_mode_notes_sanitize_fraction',
97 + 'sanitize_callback' => 'openstation_notes_sanitize_fraction',
100 98 )
101 99 );
102 100
103 101 register_post_meta(
104 - DESKTOP_MODE_NOTES_POST_TYPE,
102 + OPENSTATION_NOTES_POST_TYPE,
105 103 '_wpd_note_y',
106 104 array(
107 105 'type' => 'number',
108 106 'single' => true,
109 107 'default' => 0.1,
110 - 'sanitize_callback' => 'desktop_mode_notes_sanitize_fraction',
108 + 'sanitize_callback' => 'openstation_notes_sanitize_fraction',
111 109 )
112 110 );
113 111
114 112 register_post_meta(
115 - DESKTOP_MODE_NOTES_POST_TYPE,
113 + OPENSTATION_NOTES_POST_TYPE,
116 114 '_wpd_note_z',
117 115 array(
118 116 'type' => 'integer',
119 117 'single' => true,
@@ -124,9 +122,9 @@
124 122
125 123 // Jitter seed — hashed from the note's text once at CREATION and
126 124 // never rewritten, so the paper's subtle tilt survives edits.
127 125 register_post_meta(
128 - DESKTOP_MODE_NOTES_POST_TYPE,
126 + OPENSTATION_NOTES_POST_TYPE,
129 127 '_wpd_note_seed',
130 128 array(
131 129 'type' => 'integer',
132 130 'single' => true,
@@ -134,9 +132,9 @@
134 132 'sanitize_callback' => 'absint',
135 133 )
136 134 );
137 135 }
138 -add_action( 'init', 'desktop_mode_notes_register_cpt' );
136 +add_action( 'init', 'openstation_notes_register_cpt' );
139 137
140 138 /**
141 139 * Clamp a note color to the allowed pastel whitelist.
142 140 *
@@ -142,11 +140,11 @@
142 140 *
143 141 * @param mixed $color Raw value.
144 142 * @return string Whitelisted slug (falls back to 'butter').
145 143 */
146 -function desktop_mode_notes_sanitize_color( $color ) {
144 +function openstation_notes_sanitize_color( $color ) {
147 145 $color = is_scalar( $color ) ? sanitize_key( (string) $color ) : '';
148 - $colors = desktop_mode_notes_colors();
146 + $colors = openstation_notes_colors();
149 147 if ( in_array( $color, $colors, true ) ) {
150 148 return $color;
151 149 }
152 150 return isset( $colors[0] ) ? $colors[0] : 'butter';
@@ -157,9 +155,9 @@
157 155 *
158 156 * @param mixed $value Raw value.
159 157 * @return float
160 158 */
161 -function desktop_mode_notes_sanitize_fraction( $value ) {
159 +function openstation_notes_sanitize_fraction( $value ) {
162 160 return (float) min( 1, max( 0, (float) $value ) );
163 161 }
164 162
165 163 /**
@@ -173,10 +171,10 @@
173 171 * @param int $post_id Post ID.
174 172 * @param string $previous_status Status the post had before trashing.
175 173 * @return string
176 174 */
177 -function desktop_mode_notes_untrash_status( $new_status, $post_id, $previous_status ) {
178 - if ( DESKTOP_MODE_NOTES_POST_TYPE !== get_post_type( $post_id ) ) {
175 +function openstation_notes_untrash_status( $new_status, $post_id, $previous_status ) {
176 + if ( OPENSTATION_NOTES_POST_TYPE !== get_post_type( $post_id ) ) {
179 177 return $new_status;
180 178 }
181 179 if ( in_array( $previous_status, array( 'private', 'publish' ), true ) ) {
182 180 return $previous_status;
@@ -182,5 +180,5 @@
182 180 return $previous_status;
183 181 }
184 182 return 'private';
185 183 }
186 -add_filter( 'wp_untrash_post_status', 'desktop_mode_notes_untrash_status', 10, 3 );
184 +add_filter( 'wp_untrash_post_status', 'openstation_notes_untrash_status', 10, 3 );