PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.11
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.11
1.1.11 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 All 35 releases
desktop-mode / apps / pages / pages.os.php

pages.os.php in OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin 1.1.11, at apps/pages/pages.os.php

105 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Pages — the native Pages window, as an OpenStation app.
4 *
5 * Claims the FROZEN window id `desktop-mode-pages` (see AGENTS.md).
6 * The Posts app's twin over `/wp/v2/pages`: hierarchical (a Parent
7 * column, `menu_order` by default), a Template / Slug / Comments
8 * column set, front-page and posts-page badges, and no taxonomy tabs.
9 * The list machinery is shared with the Posts app — this entry
10 * requires `apps/posts/parts/query.php` and `pages.os.ts` composes the
11 * same client parts (sanctioned cross-app reuse, noted in both).
12 *
13 * (Header kept short on purpose: Plugin Check's direct-access scan
14 * reads only the first 50 raw lines, and the guard must land inside.)
15 *
16 * @package OpenStation
17 */
18
19 namespace OpenStation\Apps\Pages;
20
21 use OpenStation\App;
22 use OpenStation\App\Os;
23 use OpenStation\App\State;
24
25 // Direct access, unless a standalone host is booting on bare PHP.
26 if ( ! defined( 'ABSPATH' ) ) {
27 defined( 'OPENSTATION_STANDALONE' ) || exit;
28 }
29
30 require_once __DIR__ . '/parts/permissions.php';
31 require_once __DIR__ . '/parts/query.php';
32 require_once dirname( __DIR__ ) . '/posts/parts/query.php';
33
34 return App::define( 'desktop-mode-pages' )
35 ->title( __( 'Pages', 'desktop-mode' ) )
36 ->icon( 'dashicons-admin-page' )
37 ->size( 1100, 720 )
38 ->min_size( 720, 480 )
39 // The Pages dock tile is WordPress's own; the shell's URL remap
40 // routes `edit.php?post_type=page` here under `nativePagesEnabled`.
41 ->placement( 'none' )
42 ->can(
43 static function () {
44 return openstation_pages_window_user_can_register();
45 }
46 )
47 ->config(
48 static function () {
49 return openstation_pages_app_config();
50 }
51 )
52 ->state( openstation_posts_app_state( 'menu_order', 'asc' ) )
53 // Same as Posts. Page atlas is the case the declaration exists
54 // for: a tab wp-admin has no screen for, which the dock now
55 // offers as a row because this list says so.
56 ->menu(
57 'edit.php?post_type=page',
58 static function () {
59 return array(
60 'posts' => array(
61 'label' => __( 'All pages', 'desktop-mode' ),
62 'page' => 'edit.php?post_type=page',
63 ),
64 'new' => array(
65 'label' => __( 'Add Page', 'desktop-mode' ),
66 'page' => 'post-new.php?post_type=page',
67 ),
68 // No wp-admin page behind this one; the dock offers it
69 // because this list says so.
70 'atlas' => __( 'Page atlas', 'desktop-mode' ),
71 );
72 },
73 'openstation_pages_window_user_can_use'
74 )
75 ->action(
76 'filter',
77 static function ( State $state ) {
78 openstation_posts_app_filter( $state );
79 }
80 )
81 ->action(
82 'page',
83 static function ( State $state, Os $os, array $args ) {
84 openstation_posts_app_page( $state, $args );
85 }
86 )
87 ->action(
88 'sort',
89 static function ( State $state, Os $os, array $args ) {
90 openstation_posts_app_sort( $state, $args, 'menu_order', 'asc' );
91 }
92 )
93 ->action(
94 'trash',
95 static function ( State $state, Os $os, array $args ) {
96 openstation_posts_app_trash( $os, $args, 'page' );
97 }
98 )
99 ->watch( 'page' )
100 ->data(
101 static function ( State $state ) {
102 return openstation_posts_app_data( 'wp/v2/pages', openstation_pages_window_default_query_args(), $state );
103 }
104 );
105