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 -8 0.9.81.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,9 +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
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
31 42 */
32 43
33 44 defined( 'ABSPATH' ) || exit;
34 45
@@ -37,9 +48,9 @@
37 48 * can't run, and return the array ready for the window config blob.
38 49 *
39 50 * @return array[]
40 51 */
41 -function desktop_mode_my_wordpress_collect_preview_actions() {
52 +function openstation_my_wordpress_collect_preview_actions() {
42 53 /**
43 54 * Filter the list of preview-action descriptors that appear in
44 55 * the right-pane of any My WordPress section.
45 56 *
@@ -48,9 +59,9 @@
48 59 * `mime`, `sections`, `script`) will continue to work.
49 60 *
50 61 * @param array[] $actions Default: empty array.
51 62 */
52 - $actions = (array) apply_filters( 'desktop_mode_my_wordpress_preview_actions', array() );
63 + $actions = (array) apply_filters( 'openstation_my_wordpress_preview_actions', array() );
53 64
54 65 $out = array();
55 66 foreach ( $actions as $action ) {
56 67 if ( ! is_array( $action ) || empty( $action['id'] ) || empty( $action['label'] ) ) {
@@ -87,13 +98,13 @@
87 98 * Enqueue the JS handles declared by visible preview-action
88 99 * descriptors. Called from the bundle's `admin_enqueue_scripts`
89 100 * hook so the handlers are wired before the bundle paints.
90 101 */
91 -function desktop_mode_my_wordpress_enqueue_preview_action_scripts() {
92 - 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() ) {
93 104 return;
94 105 }
95 - $actions = desktop_mode_my_wordpress_collect_preview_actions();
106 + $actions = openstation_my_wordpress_collect_preview_actions();
96 107 foreach ( $actions as $action ) {
97 108 if ( ! empty( $action['script'] ) && wp_script_is( (string) $action['script'], 'registered' ) ) {
98 109 wp_enqueue_script( (string) $action['script'] );
99 110 }
@@ -98,5 +109,5 @@
98 109 wp_enqueue_script( (string) $action['script'] );
99 110 }
100 111 }
101 112 }
102 -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 );