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/recycle-bin.php +23 -23 0.9.81.1.10 View file →
@@ -1,7 +1,7 @@
1 1 <?php
2 2 /**
3 - * Desktop Mode — Pinned notes in the Recycle Bin.
3 + * OpenStation — Pinned notes in the Recycle Bin.
4 4 *
5 5 * `wpd_note` is a headless CPT (`show_ui => false`), so the bin's
6 6 * auto-capture of admin-UI post types skips it — this file opts it in
7 7 * through the bin's existing filter pipeline and adapts the generic
@@ -28,9 +28,9 @@
28 28 * `wp_untrash_post_status` filter in `cpt.php` brings the note back
29 29 * with its original private/publish status, and the Heartbeat delta
30 30 * re-pins it on the wall without a reload.
31 31 *
32 - * @package WPDesktopMode
32 + * @package OpenStation
33 33 */
34 34
35 35 defined( 'ABSPATH' ) || exit;
36 36
@@ -39,14 +39,14 @@
39 39 *
40 40 * @param string[] $types Tracked post types.
41 41 * @return string[]
42 42 */
43 -function desktop_mode_notes_recycle_bin_capture_types( $types ) {
43 +function openstation_notes_recycle_bin_capture_types( $types ) {
44 44 $types = (array) $types;
45 - $types[] = DESKTOP_MODE_NOTES_POST_TYPE;
45 + $types[] = OPENSTATION_NOTES_POST_TYPE;
46 46 return $types;
47 47 }
48 -add_filter( 'desktop_mode_recycle_bin_capture_post_types', 'desktop_mode_notes_recycle_bin_capture_types' );
48 +add_filter( 'openstation_recycle_bin_capture_post_types', 'openstation_notes_recycle_bin_capture_types' );
49 49
50 50 /**
51 51 * Whether a trashed post is a note owned by the current user.
52 52 *
@@ -52,10 +52,10 @@
52 52 *
53 53 * @param WP_Post $post Trashed post.
54 54 * @return bool
55 55 */
56 -function desktop_mode_notes_recycle_bin_owns( $post ) {
57 - return (int) $post->post_author === get_current_user_id();
56 +function openstation_notes_recycle_bin_owns( $post ) {
57 + return get_current_user_id() === (int) $post->post_author;
58 58 }
59 59
60 60 /**
61 61 * Owner-only view/restore/purge for notes — replaces the bin's
@@ -64,17 +64,17 @@
64 64 * @param bool $can The bin's default answer.
65 65 * @param WP_Post $post Trashed post.
66 66 * @return bool
67 67 */
68 -function desktop_mode_notes_recycle_bin_gate( $can, $post ) {
69 - if ( DESKTOP_MODE_NOTES_POST_TYPE !== $post->post_type ) {
68 +function openstation_notes_recycle_bin_gate( $can, $post ) {
69 + if ( OPENSTATION_NOTES_POST_TYPE !== $post->post_type ) {
70 70 return $can;
71 71 }
72 - return desktop_mode_notes_recycle_bin_owns( $post );
72 + return openstation_notes_recycle_bin_owns( $post );
73 73 }
74 -add_filter( 'desktop_mode_recycle_bin_user_can_view', 'desktop_mode_notes_recycle_bin_gate', 10, 2 );
75 -add_filter( 'desktop_mode_recycle_bin_user_can_restore', 'desktop_mode_notes_recycle_bin_gate', 10, 2 );
76 -add_filter( 'desktop_mode_recycle_bin_user_can_purge', 'desktop_mode_notes_recycle_bin_gate', 10, 2 );
74 +add_filter( 'openstation_recycle_bin_user_can_view', 'openstation_notes_recycle_bin_gate', 10, 2 );
75 +add_filter( 'openstation_recycle_bin_user_can_restore', 'openstation_notes_recycle_bin_gate', 10, 2 );
76 +add_filter( 'openstation_recycle_bin_user_can_purge', 'openstation_notes_recycle_bin_gate', 10, 2 );
77 77
78 78 /**
79 79 * Paper-flavored row shape for trashed notes.
80 80 *
@@ -81,15 +81,15 @@
81 81 * @param array $item Bin item shape.
82 82 * @param WP_Post $post Source post.
83 83 * @return array
84 84 */
85 -function desktop_mode_notes_recycle_bin_item( $item, $post ) {
86 - if ( DESKTOP_MODE_NOTES_POST_TYPE !== $post->post_type ) {
85 +function openstation_notes_recycle_bin_item( $item, $post ) {
86 + if ( OPENSTATION_NOTES_POST_TYPE !== $post->post_type ) {
87 87 return $item;
88 88 }
89 89 $item['type_label'] = __( 'Note', 'desktop-mode' );
90 90 $item['icon'] = 'dashicons-sticky';
91 - $item['subtitle'] = wp_trim_words( desktop_mode_recycle_bin_plain_text( (string) $post->post_content ), 18, '…' );
91 + $item['subtitle'] = wp_trim_words( openstation_recycle_bin_plain_text( (string) $post->post_content ), 18, '…' );
92 92 // Notes have no admin edit screen — a chromeless post.php iframe
93 93 // would 403 on the headless CPT.
94 94 $item['edit_link'] = '';
95 95
@@ -108,9 +108,9 @@
108 108 }
109 109
110 110 return $item;
111 111 }
112 -add_filter( 'desktop_mode_recycle_bin_item', 'desktop_mode_notes_recycle_bin_item', 10, 2 );
112 +add_filter( 'openstation_recycle_bin_item', 'openstation_notes_recycle_bin_item', 10, 2 );
113 113
114 114 /**
115 115 * Number of trashed notes for a given scope.
116 116 *
@@ -116,11 +116,11 @@
116 116 *
117 117 * @param int|null $author_id Scope to one author, or null for all.
118 118 * @return int
119 119 */
120 -function desktop_mode_notes_recycle_bin_trashed_count( $author_id = null ) {
120 +function openstation_notes_recycle_bin_trashed_count( $author_id = null ) {
121 121 $args = array(
122 - 'post_type' => DESKTOP_MODE_NOTES_POST_TYPE,
122 + 'post_type' => OPENSTATION_NOTES_POST_TYPE,
123 123 'post_status' => 'trash',
124 124 'posts_per_page' => 1,
125 125 'fields' => 'ids',
126 126 'no_found_rows' => false,
@@ -143,15 +143,15 @@
143 143 *
144 144 * @param int $total Generic total.
145 145 * @return int
146 146 */
147 -function desktop_mode_notes_recycle_bin_count( $total ) {
147 +function openstation_notes_recycle_bin_count( $total ) {
148 148 $total = (int) $total;
149 - $own = desktop_mode_notes_recycle_bin_trashed_count( get_current_user_id() );
149 + $own = openstation_notes_recycle_bin_trashed_count( get_current_user_id() );
150 150
151 151 if ( current_user_can( 'edit_others_posts' ) ) {
152 152 // Counted everyone's notes; keep only ours.
153 - $total = $total - desktop_mode_notes_recycle_bin_trashed_count() + $own;
153 + $total = $total - openstation_notes_recycle_bin_trashed_count() + $own;
154 154 } elseif ( ! current_user_can( 'edit_posts' ) ) {
155 155 // Counted none of ours; add them.
156 156 $total = $total + $own;
157 157 }
@@ -158,5 +158,5 @@
158 158 // `edit_posts`-only users were already counted author-scoped.
159 159
160 160 return max( 0, $total );
161 161 }
162 -add_filter( 'desktop_mode_recycle_bin_count', 'desktop_mode_notes_recycle_bin_count' );
162 +add_filter( 'openstation_recycle_bin_count', 'openstation_notes_recycle_bin_count' );