| @@ -1,87 +1,178 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Desktop Mode — My WordPress: window + pinned icon registration. | |
| 3 | + * OpenStation — My WordPress: the explorer's identity + shared helpers. | |
| 4 | 4 | * |
| 5 | - * Native window with id `desktop-mode-my-wordpress`, opened from a | |
| 6 | - * pinned desktop icon that always sits in the top-left of the grid | |
| 7 | - * (`pinned: true`, `position: -1`). The bundle renders a two-pane | |
| 8 | - * file-explorer UI with breadcrumb navigation: root shows Posts and | |
| 9 | - * Pages folder tiles, and clicking either drills into an | |
| 10 | - * infinite-scroll list of entities with a rendered HTML preview pane. | |
| 5 | + * The app people open is `apps/my-wordpress/` — WP Explorer, rebuilt | |
| 6 | + * on the App Framework. This module keeps what the port shares: the | |
| 7 | + * name and the folder-mark icon (the app reads both from the helpers | |
| 8 | + * here), the capability gate, and the inert entities compatibility | |
| 9 | + * surface (see the note at the end of the file). | |
| 11 | 10 | * |
| 12 | - * Filterable surface (mirrors the recycle-bin / posts-window modules): | |
| 11 | + * **The app is called WP Explorer; the module is called my-wordpress.** | |
| 12 | + * The function prefix and every `openstation_my_wordpress_*` filter | |
| 13 | + * are names plugins already reference — the frozen-values rule in | |
| 14 | + * AGENTS.md keeps them put. | |
| 13 | 15 | * |
| 14 | - * - `desktop_mode_my_wordpress_window_args` | |
| 15 | - * - `desktop_mode_my_wordpress_icon_args` | |
| 16 | - * - `desktop_mode_my_wordpress_user_can_use` | |
| 17 | - * - `desktop_mode_my_wordpress_entities` | |
| 18 | - * - `desktop_mode_my_wordpress_template_html` | |
| 16 | + * Filterable surface: | |
| 19 | 17 | * |
| 20 | - * @package WPDesktopMode | |
| 21 | - * @since 0.8.0 | |
| 18 | + * - `openstation_my_wordpress_user_can_use` | |
| 19 | + * - `openstation_my_wordpress_entities` (inert — see the end note) | |
| 20 | + * | |
| 21 | + * (`openstation_my_wordpress_icon_args`, `_window_args` and | |
| 22 | + * `_template_html` went with the legacy window they configured.) | |
| 23 | + * | |
| 24 | + * @package OpenStation | |
| 22 | 25 | */ |
| 23 | 26 | |
| 24 | 27 | defined( 'ABSPATH' ) || exit; |
| 25 | 28 | |
| 26 | 29 | /** |
| 30 | + * Display name of the app, for the window title and the pinned icon. | |
| 31 | + * | |
| 32 | + * A file explorer, named after what it explores. The window used to | |
| 33 | + * carry the site title instead, on the reasoning that the desktop holds | |
| 34 | + * objects rather than a mention of the software you are already standing | |
| 35 | + * in — but a site title is what the *root folder* is called, not what | |
| 36 | + * the app is called, and the breadcrumb still says it. The two are no | |
| 37 | + * longer the same string. | |
| 38 | + * | |
| 39 | + * @return string | |
| 40 | + */ | |
| 41 | +function openstation_my_wordpress_app_title() { | |
| 42 | + return __( 'WP Explorer', 'desktop-mode' ); | |
| 43 | +} | |
| 44 | + | |
| 45 | +/** | |
| 46 | + * The app's icon: a folder wearing the WordPress mark. | |
| 47 | + * | |
| 48 | + * The window used to wear `dashicons-wordpress`, the double-ringed | |
| 49 | + * wp.org mark, which said "WordPress" and nothing about what the app | |
| 50 | + * does — every other window here is WordPress too. A folder says | |
| 51 | + * "browse", and the single-ringed mark inside it says whose files. | |
| 52 | + * | |
| 53 | + * Drawn in `currentColor` so both painters mask it: the dock masks | |
| 54 | + * image icons to the rail's own glyph colour so a plugin's brand | |
| 55 | + * colours cannot break the monochrome rail, and `renderIcon()` masks it | |
| 56 | + * to the title bar's text colour. A literal fill would silently turn it | |
| 57 | + * back into a background image in one and a solid blob in the other. | |
| 58 | + * | |
| 59 | + * The folder is outlined rather than filled so the mark inside it stays | |
| 60 | + * a mark: on a filled folder, a same-colour mark is invisible. Hand- | |
| 61 | + * placed at 64×64, the established canvas for the custom icons here, | |
| 62 | + * and held to two shapes because it renders as small as 20px in the | |
| 63 | + * dock. The mark's own path is the upstream single-ringed logo, a | |
| 64 | + * filled disc with the W knocked out by the nonzero fill rule. | |
| 65 | + * | |
| 66 | + * On the sizing: the front panel runs `y 19.1 → 52.1` on the | |
| 67 | + * centreline, so at stroke 3 the clear height inside it is 30 units. | |
| 68 | + * The mark takes 20 of those at scale 1, centred on 35.6, which leaves | |
| 69 | + * five units above and below. It used to be scaled 1.15× for 23 units | |
| 70 | + * and barely three units of clearance, less than one stroke width, and | |
| 71 | + * a disc that close to the panel edge reads as crammed in rather than | |
| 72 | + * placed. Horizontal clearance was never the constraint: the panel is | |
| 73 | + * 50 units wide against the mark's 20. | |
| 74 | + * | |
| 75 | + * @return string Raw `<svg>` markup. | |
| 76 | + */ | |
| 77 | +function openstation_my_wordpress_icon_svg() { | |
| 78 | + return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">' | |
| 79 | + // The folder: back tab, notch, front panel, all one outline. | |
| 80 | + . '<path d="M11 13h12.2a3 3 0 0 1 2.4 1.2l2.8 3.7a3 3 0 0 0 2.4 1.2H53a4 4 0 0 1 4 4v25a4 4 0 0 1-4 4H11a4 4 0 0 1-4-4V17a4 4 0 0 1 4-4z"' | |
| 81 | + . ' fill="none" stroke="currentColor" stroke-width="3" stroke-linejoin="round"/>' | |
| 82 | + // The WordPress mark, centred on the front panel at r=10. | |
| 83 | + . '<g transform="translate(22 25.6) scale(1)">' | |
| 84 | + . '<path fill="currentColor" d="M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"/>' | |
| 85 | + . '</g>' | |
| 86 | + . '</svg>'; | |
| 87 | +} | |
| 88 | + | |
| 89 | +/** | |
| 27 | 90 | * Whether the current user should see My WordPress. |
| 28 | 91 | * |
| 29 | 92 | * Mirrors the recycle-bin gate — anyone who can edit posts can |
| 30 | 93 | * browse posts and pages. |
| 31 | 94 | * |
| 32 | - * @since 0.8.0 | |
| 95 | + * This is the module's one capability gate, and it is a **server-side | |
| 96 | + * authorization** gate, not just a visibility one. It decides: | |
| 33 | 97 | * |
| 98 | + * - The non-REST post-type bridge: whether | |
| 99 | + * `desktop-mode/v1/post-type/<slug>` routes register at all | |
| 100 | + * (`rest-post-type.php`). | |
| 101 | + * - The per-comment dossier route | |
| 102 | + * `desktop-mode/v1/comment-stats/<id>` (`comment-stats.php`). | |
| 103 | + * - The user and term dossier routes | |
| 104 | + * `desktop-mode/v1/user-stats/<id>`, | |
| 105 | + * `desktop-mode/v1/user-footprint/<id>` and | |
| 106 | + * `desktop-mode/v1/term-stats/<taxonomy>/<id>` (`user-stats.php`, | |
| 107 | + * `user-footprint.php`, `term-stats.php`), which then scope their | |
| 108 | + * payloads to what the caller may read. | |
| 109 | + * - Whether the WooCommerce integration's boot config ships, so the | |
| 110 | + * client can reach the order / customer / product surfaces at all | |
| 111 | + * — those routes still enforce their own Woo capabilities on top | |
| 112 | + * (`integrations/woocommerce.php`). | |
| 113 | + * - Whether preview-action scripts registered by plugins are | |
| 114 | + * enqueued (`preview-actions.php`). | |
| 115 | + * - Whether Station Home offers the "WP Explorer" quick action | |
| 116 | + * (`apps/station-home/parts/snapshot.php`). | |
| 117 | + * | |
| 118 | + * It does **not** gate the app's own window or pinned launcher: WP | |
| 119 | + * Explorer is an App Framework app and declares | |
| 120 | + * `->capabilities( 'edit_posts' )` itself (`apps/my-wordpress/`). | |
| 121 | + * Returning `true` here opens the surfaces above without opening the | |
| 122 | + * window; to move the window too, filter the app's manifest. | |
| 123 | + * | |
| 34 | 124 | * @return bool |
| 35 | 125 | */ |
| 36 | -function desktop_mode_my_wordpress_user_can_use() { | |
| 126 | +function openstation_my_wordpress_user_can_use() { | |
| 37 | 127 | $can = current_user_can( 'edit_posts' ); |
| 38 | 128 | |
| 39 | 129 | /** |
| 40 | - * Filter whether the current user can see the My WordPress | |
| 41 | - * pinned icon and window. | |
| 130 | + * Filter whether the current user can reach the My WordPress | |
| 131 | + * module's surfaces — its REST routes included. | |
| 42 | 132 | * |
| 43 | - * @since 0.8.0 | |
| 44 | - * | |
| 45 | 133 | * @param bool $can Default: edit_posts capability. |
| 46 | 134 | */ |
| 47 | - return (bool) apply_filters( 'desktop_mode_my_wordpress_user_can_use', $can ); | |
| 135 | + return (bool) apply_filters( 'openstation_my_wordpress_user_can_use', $can ); | |
| 48 | 136 | } |
| 49 | 137 | |
| 50 | 138 | /** |
| 51 | - * Build the entity list shipped to the bundle. Posts, Pages, and — | |
| 52 | - * since 0.20.0 — Users. Future phases add Comments, Tags, | |
| 53 | - * Categories, Themes, and Plugins. | |
| 139 | + * Build the entity list shipped to the bundle. Posts, Pages, | |
| 140 | + * Users, and Media. Future phases add | |
| 141 | + * Comments, Tags, Categories, Themes, and Plugins. | |
| 54 | 142 | * |
| 55 | 143 | * The optional `kind` field tells the bundle how to render entries |
| 56 | 144 | * of this entity: `'post'` (default) renders the standard |
| 57 | 145 | * title/excerpt/featured-image tile and the rendered-HTML preview; |
| 58 | 146 | * `'user'` renders an avatar + display-name tile and routes to the |
| 59 | - * user dossier preview. Plugins extending the entity list with a | |
| 60 | - * post-shaped collection can omit the field; user-shaped | |
| 61 | - * collections must set `'user'`. | |
| 147 | + * user dossier preview; `'media'` renders a thumbnail-grid tile and | |
| 148 | + * routes to the media preview pane. Plugins extending the entity | |
| 149 | + * list with a post-shaped collection can omit the field; user- and | |
| 150 | + * media-shaped collections must set `'user'` / `'media'`. | |
| 151 | + * The optional `post_type` field specifies the WP post-type | |
| 152 | + * slug used for `os.<slug>.changed` cross-window broadcasts. | |
| 62 | 153 | * |
| 63 | - * @since 0.8.0 | |
| 64 | - * | |
| 65 | 154 | * @return array[] Each entry is `array( 'id', 'label', 'icon', |
| 66 | - * 'restPath', 'kind' )`. `restPath` is appended to | |
| 155 | + * 'restPath', 'kind', 'post_type' )`. `restPath` is appended to | |
| 67 | 156 | * the `restRoot` config to derive the list URL. |
| 68 | 157 | */ |
| 69 | -function desktop_mode_my_wordpress_entities() { | |
| 158 | +function openstation_my_wordpress_entities() { | |
| 70 | 159 | $entities = array( |
| 71 | 160 | array( |
| 72 | - 'id' => 'posts', | |
| 73 | - 'label' => __( 'Posts', 'desktop-mode' ), | |
| 74 | - 'icon' => 'dashicons-admin-post', | |
| 75 | - 'restPath' => 'wp/v2/posts', | |
| 76 | - 'kind' => 'post', | |
| 161 | + 'id' => 'posts', | |
| 162 | + 'label' => __( 'Posts', 'desktop-mode' ), | |
| 163 | + 'icon' => 'dashicons-admin-post', | |
| 164 | + 'restPath' => 'wp/v2/posts', | |
| 165 | + 'kind' => 'post', | |
| 166 | + 'post_type' => 'post', | |
| 77 | 167 | ), |
| 78 | 168 | array( |
| 79 | - 'id' => 'pages', | |
| 80 | - 'label' => __( 'Pages', 'desktop-mode' ), | |
| 81 | - 'icon' => 'dashicons-admin-page', | |
| 82 | - 'restPath' => 'wp/v2/pages', | |
| 83 | - 'kind' => 'post', | |
| 169 | + 'id' => 'pages', | |
| 170 | + 'label' => __( 'Pages', 'desktop-mode' ), | |
| 171 | + 'icon' => 'dashicons-admin-page', | |
| 172 | + 'restPath' => 'wp/v2/pages', | |
| 173 | + 'kind' => 'post', | |
| 174 | + 'post_type' => 'page', | |
| 84 | 175 | ), |
| 85 | 176 | array( |
| 86 | 177 | 'id' => 'users', |
| 87 | 178 | 'label' => __( 'Users', 'desktop-mode' ), |
| @@ -89,13 +180,14 @@ | ||
| 89 | 180 | 'restPath' => 'wp/v2/users', |
| 90 | 181 | 'kind' => 'user', |
| 91 | 182 | ), |
| 92 | 183 | array( |
| 93 | - 'id' => 'media', | |
| 94 | - 'label' => __( 'Media', 'desktop-mode' ), | |
| 95 | - 'icon' => 'dashicons-admin-media', | |
| 96 | - 'restPath' => 'wp/v2/media', | |
| 97 | - 'kind' => 'media', | |
| 184 | + 'id' => 'media', | |
| 185 | + 'label' => __( 'Media', 'desktop-mode' ), | |
| 186 | + 'icon' => 'dashicons-admin-media', | |
| 187 | + 'restPath' => 'wp/v2/media', | |
| 188 | + 'kind' => 'media', | |
| 189 | + 'post_type' => 'attachment', | |
| 98 | 190 | ), |
| 99 | 191 | ); |
| 100 | 192 | |
| 101 | 193 | /** |
| @@ -110,140 +202,44 @@ | ||
| 110 | 202 | * fields will continue to work; new optional fields will not |
| 111 | 203 | * break existing consumers. The `kind` field is optional and |
| 112 | 204 | * defaults to `'post'` for back-compat. |
| 113 | 205 | * |
| 114 | - * @since 0.8.0 | |
| 206 | + * Optional fields: | |
| 207 | + * - `kind` — render strategy (`'post'` default, `'user'`, `'media'`). | |
| 208 | + * - `post_type` — WP post-type slug for cross-window broadcast topic `os.<slug>.changed`. | |
| 209 | + * - `thumbnails` — set false to keep the section icon on every tile | |
| 210 | + * instead of the entity's featured image. | |
| 211 | + * - `editAction` — who edits this section's rows. A preview-action id | |
| 212 | + * (see `openstation_my_wordpress_preview_actions`) | |
| 213 | + * replaces "Open in editor" everywhere — pane button, | |
| 214 | + * context-menu open entry, tile double-click. `false` | |
| 215 | + * removes every edit affordance (double-click falls | |
| 216 | + * back to the detail dossier; the bulk "Edit…" modal | |
| 217 | + * is suppressed). Omit for the classic editor. | |
| 218 | + * - `group` — folder id this section nests under at the root | |
| 219 | + * (null / omitted renders it loose at the root). | |
| 220 | + * - `groupLabel` — folder label. `groupIcon`, `groupOrder` follow. | |
| 115 | 221 | * |
| 116 | 222 | * @param array[] $entities Default entities. |
| 117 | 223 | */ |
| 118 | - $filtered = apply_filters( 'desktop_mode_my_wordpress_entities', $entities ); | |
| 224 | + $filtered = apply_filters( 'openstation_my_wordpress_entities', $entities ); | |
| 119 | 225 | return is_array( $filtered ) ? array_values( $filtered ) : $entities; |
| 120 | 226 | } |
| 121 | 227 | |
| 122 | -/** | |
| 123 | - * Render the My WordPress window's static template body. The bundle | |
| 124 | - * mounts its UI into `[data-desktop-mode-my-wordpress-root]`. | |
| 228 | +/* | |
| 229 | + * No window, no template, no launcher. The explorer people open is | |
| 230 | + * the `my-wordpress` APP (`apps/my-wordpress/`), which reclaimed the | |
| 231 | + * "WP Explorer" name and the folder mark from this module's helpers | |
| 232 | + * above. The legacy native window, its bundle and its pinned icon are | |
| 233 | + * gone; every deep surface it used to host moved with the port — the | |
| 234 | + * detail dossiers and the activity footprint render inside the app, | |
| 235 | + * "open this object" travels through the shared stores in | |
| 236 | + * `src/open-targets/explorer-open.ts` / `footprint-target.ts`, and | |
| 237 | + * the Recycle Bin trashes dropped rows by their payload's `restPath`. | |
| 125 | 238 | * |
| 126 | - * @since 0.8.0 | |
| 239 | + * `openstation_my_wordpress_entities()` and its filter remain as an | |
| 240 | + * inert compatibility surface: subscribers registered against them | |
| 241 | + * (WooCommerce's own among them) still run, and the pure helpers are | |
| 242 | + * still what the tests pin — but nothing consumes the list to build a | |
| 243 | + * window any more. The `openstation_my_wordpress_window_args` / | |
| 244 | + * `openstation_my_wordpress_template_html` filters no longer fire. | |
| 127 | 245 | */ |
| 128 | -function desktop_mode_my_wordpress_render_template() { | |
| 129 | - ob_start(); | |
| 130 | - ?> | |
| 131 | - <div class="desktop-mode-my-wordpress" data-desktop-mode-my-wordpress-root> | |
| 132 | - <header data-desktop-mode-my-wordpress-breadcrumbs></header> | |
| 133 | - <div class="desktop-mode-my-wordpress__body" data-desktop-mode-my-wordpress-body> | |
| 134 | - <div class="desktop-mode-my-wordpress__loading" data-desktop-mode-my-wordpress-loading hidden> | |
| 135 | - <wpd-spinner></wpd-spinner> | |
| 136 | - </div> | |
| 137 | - </div> | |
| 138 | - <div class="desktop-mode-folder-status-bar" data-desktop-mode-my-wordpress-status></div> | |
| 139 | - </div> | |
| 140 | - <?php | |
| 141 | - $html = (string) ob_get_clean(); | |
| 142 | - | |
| 143 | - /** | |
| 144 | - * Filter the My WordPress window's template HTML. | |
| 145 | - * | |
| 146 | - * @since 0.8.0 | |
| 147 | - * | |
| 148 | - * @param string $html Default template HTML. | |
| 149 | - */ | |
| 150 | - $filtered = (string) apply_filters( 'desktop_mode_my_wordpress_template_html', $html ); | |
| 151 | - | |
| 152 | - $allowed_html = function_exists( 'desktop_mode_native_window_allowed_html' ) | |
| 153 | - ? desktop_mode_native_window_allowed_html() | |
| 154 | - : wp_kses_allowed_html( 'post' ); | |
| 155 | - | |
| 156 | - echo wp_kses( $filtered, $allowed_html ); | |
| 157 | -} | |
| 158 | - | |
| 159 | -/** | |
| 160 | - * Register the native window + the pinned wallpaper icon on `init`, | |
| 161 | - * priority 20 — after `components.php` boots the registry. | |
| 162 | - * | |
| 163 | - * @since 0.8.0 | |
| 164 | - */ | |
| 165 | -function desktop_mode_my_wordpress_register_window() { | |
| 166 | - if ( ! desktop_mode_my_wordpress_user_can_use() ) { | |
| 167 | - return; | |
| 168 | - } | |
| 169 | - | |
| 170 | - $window_args = array( | |
| 171 | - 'title' => __( 'My WordPress', 'desktop-mode' ), | |
| 172 | - 'icon' => 'dashicons-wordpress', | |
| 173 | - 'template' => 'desktop_mode_my_wordpress_render_template', | |
| 174 | - 'script' => 'desktop-mode-my-wordpress', | |
| 175 | - 'style' => 'desktop-mode-my-wordpress', | |
| 176 | - 'width' => 960, | |
| 177 | - 'height' => 640, | |
| 178 | - 'min_width' => 640, | |
| 179 | - 'min_height' => 420, | |
| 180 | - 'placement' => 'none', | |
| 181 | - 'config' => array( | |
| 182 | - 'restRoot' => esc_url_raw( rest_url() ), | |
| 183 | - 'restNonce' => wp_create_nonce( 'wp_rest' ), | |
| 184 | - 'editPostUrlBase' => esc_url_raw( admin_url( 'post.php' ) ), | |
| 185 | - 'editUserUrlBase' => esc_url_raw( admin_url( 'user-edit.php' ) ), | |
| 186 | - 'entities' => desktop_mode_my_wordpress_entities(), | |
| 187 | - 'perPage' => 24, | |
| 188 | - 'mediaPerPage' => 48, | |
| 189 | - 'previewActions' => function_exists( 'desktop_mode_my_wordpress_collect_preview_actions' ) | |
| 190 | - ? desktop_mode_my_wordpress_collect_preview_actions() | |
| 191 | - : array(), | |
| 192 | - ), | |
| 193 | - ); | |
| 194 | - | |
| 195 | - /** | |
| 196 | - * Filter the args used to register the My WordPress native window. | |
| 197 | - * | |
| 198 | - * @since 0.8.0 | |
| 199 | - * | |
| 200 | - * @param array $window_args Args passed to `desktop_mode_register_window()`. | |
| 201 | - */ | |
| 202 | - $window_args = (array) apply_filters( 'desktop_mode_my_wordpress_window_args', $window_args ); | |
| 203 | - | |
| 204 | - $registered = desktop_mode_register_window( 'desktop-mode-my-wordpress', $window_args ); | |
| 205 | - if ( is_wp_error( $registered ) ) { | |
| 206 | - // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log | |
| 207 | - error_log( '[desktop-mode] My WordPress window registration failed: ' . $registered->get_error_message() ); | |
| 208 | - return; | |
| 209 | - } | |
| 210 | - | |
| 211 | - $icon_args = array( | |
| 212 | - 'title' => __( 'My WordPress', 'desktop-mode' ), | |
| 213 | - 'icon' => 'dashicons-wordpress', | |
| 214 | - 'window' => 'desktop-mode-my-wordpress', | |
| 215 | - 'pinned' => true, | |
| 216 | - 'position' => -1, | |
| 217 | - ); | |
| 218 | - | |
| 219 | - /** | |
| 220 | - * Filter the args used to register the My WordPress pinned icon. | |
| 221 | - * | |
| 222 | - * Removing `pinned` here lets the icon participate in normal | |
| 223 | - * sort order — useful for sites that want the shortcut to feel | |
| 224 | - * like any other plugin icon. | |
| 225 | - * | |
| 226 | - * @since 0.8.0 | |
| 227 | - * | |
| 228 | - * @param array $icon_args Args passed to `desktop_mode_register_icon()`. | |
| 229 | - */ | |
| 230 | - $icon_args = (array) apply_filters( 'desktop_mode_my_wordpress_icon_args', $icon_args ); | |
| 231 | - | |
| 232 | - desktop_mode_register_icon( 'desktop-mode-my-wordpress', $icon_args ); | |
| 233 | -} | |
| 234 | -add_action( 'init', 'desktop_mode_my_wordpress_register_window', 20 ); | |
| 235 | - | |
| 236 | -/** | |
| 237 | - * Enqueue the bundle's CSS in admin context. The script is lazy- | |
| 238 | - * loaded by the native-window sync and so does not need an | |
| 239 | - * `admin_enqueue_scripts` call. | |
| 240 | - * | |
| 241 | - * @since 0.8.0 | |
| 242 | - */ | |
| 243 | -function desktop_mode_my_wordpress_enqueue_styles() { | |
| 244 | - if ( ! desktop_mode_my_wordpress_user_can_use() ) { | |
| 245 | - return; | |
| 246 | - } | |
| 247 | - wp_enqueue_style( 'desktop-mode-my-wordpress' ); | |
| 248 | -} | |
| 249 | -add_action( 'admin_enqueue_scripts', 'desktop_mode_my_wordpress_enqueue_styles', 30 ); | |