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/my-wordpress/preview-actions.php +19 -15 0.8.71.1.10 View file →
@@ -1,7 +1,7 @@
1 1 <?php
2 2 /**
3 - * Desktop Mode — My WordPress: server-side preview-action descriptors.
3 + * OpenStation — My WordPress: server-side preview-action descriptors.
4 4 *
5 5 * Plugins register action buttons that appear in the right-pane of
6 6 * any My WordPress section (posts, pages, users, media, plugin-
7 7 * defined kinds). Server-side declaration buys:
@@ -26,10 +26,20 @@
26 26 * 'sections' => array( 'media' ), // optional, default all
27 27 * 'script' => 'my-plugin-actions', // optional handle
28 28 * ]
29 29 *
30 - * @package WPDesktopMode
31 - * @since 0.21.0
30 + * `sections` entries match a section's **id** (`'media'`,
31 + * `'cpt-atf-forms'` — auto-registered CPT sections are prefixed
32 + * `cpt-`), a section's declared **post type slug** (`'atf-forms'`),
33 + * or `'*'` for every section. Matching happens client-side.
34 + *
35 + * Timing: descriptors are re-collected when the window config is
36 + * serialized for the browser (see
37 + * the explorer app's per-dispatch payload), the same late
38 + * pass that enqueues declared `script` handles — registering the
39 + * filter any time during a normal bootstrap is fine.
40 + *
41 + * @package OpenStation
32 42 */
33 43
34 44 defined( 'ABSPATH' ) || exit;
35 45
@@ -36,13 +46,11 @@
36 46 /**
37 47 * Collect plugin-registered descriptors, drop ones the current user
38 48 * can't run, and return the array ready for the window config blob.
39 49 *
40 - * @since 0.21.0
41 - *
42 50 * @return array[]
43 51 */
44 -function desktop_mode_my_wordpress_collect_preview_actions() {
52 +function openstation_my_wordpress_collect_preview_actions() {
45 53 /**
46 54 * Filter the list of preview-action descriptors that appear in
47 55 * the right-pane of any My WordPress section.
48 56 *
@@ -49,13 +57,11 @@
49 57 * **Status: Experimental** — the descriptor shape may gain
50 58 * fields. Existing fields (`id`, `label`, `icon`, `capability`,
51 59 * `mime`, `sections`, `script`) will continue to work.
52 60 *
53 - * @since 0.21.0
54 - *
55 61 * @param array[] $actions Default: empty array.
56 62 */
57 - $actions = (array) apply_filters( 'desktop_mode_my_wordpress_preview_actions', array() );
63 + $actions = (array) apply_filters( 'openstation_my_wordpress_preview_actions', array() );
58 64
59 65 $out = array();
60 66 foreach ( $actions as $action ) {
61 67 if ( ! is_array( $action ) || empty( $action['id'] ) || empty( $action['label'] ) ) {
@@ -91,16 +97,14 @@
91 97 /**
92 98 * Enqueue the JS handles declared by visible preview-action
93 99 * descriptors. Called from the bundle's `admin_enqueue_scripts`
94 100 * hook so the handlers are wired before the bundle paints.
95 - *
96 - * @since 0.21.0
97 101 */
98 -function desktop_mode_my_wordpress_enqueue_preview_action_scripts() {
99 - if ( ! function_exists( 'desktop_mode_my_wordpress_user_can_use' ) || ! desktop_mode_my_wordpress_user_can_use() ) {
102 +function openstation_my_wordpress_enqueue_preview_action_scripts() {
103 + if ( ! function_exists( 'openstation_my_wordpress_user_can_use' ) || ! openstation_my_wordpress_user_can_use() ) {
100 104 return;
101 105 }
102 - $actions = desktop_mode_my_wordpress_collect_preview_actions();
106 + $actions = openstation_my_wordpress_collect_preview_actions();
103 107 foreach ( $actions as $action ) {
104 108 if ( ! empty( $action['script'] ) && wp_script_is( (string) $action['script'], 'registered' ) ) {
105 109 wp_enqueue_script( (string) $action['script'] );
106 110 }
@@ -105,5 +109,5 @@
105 109 wp_enqueue_script( (string) $action['script'] );
106 110 }
107 111 }
108 112 }
109 -add_action( 'admin_enqueue_scripts', 'desktop_mode_my_wordpress_enqueue_preview_action_scripts', 40 );
113 +add_action( 'admin_enqueue_scripts', 'openstation_my_wordpress_enqueue_preview_action_scripts', 40 );