PluginProbe ʕ •ᴥ•ʔ
Admin Columns / 7.1.4
Admin Columns v7.1.4
7.1.4 7.0.19 2.3.5 2.4 2.4.1 2.4.10 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.6.1 2.5.6.2 2.5.6.3 2.5.6.4 3.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.7 3.1 3.1.1 3.1.10 3.1.2 3.1.3 3.1.5 3.2.3 3.2.7 3.3.1 3.4.1 3.4.6 3.4.8 4.0.1 4.0.3 4.1.6 4.2.2 4.2.5 4.3 4.3.2 4.4.1 4.4.4 4.4.5 4.5.5 4.6.1 4.7.18 4.7.19 4.7.20 4.7.7 7.0.13 7.0.14 7.0.16 trunk 1.0 1.1 1.1.3 1.2 1.2.1 1.3 1.3.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.5.1 1.4.6 1.4.6.1 1.4.6.2 1.4.6.3 1.4.6.4 1.4.7 1.4.8 1.4.9 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.1.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.5.1 2.2.6 2.2.6.1 2.2.6.2 2.2.6.3 2.2.6.4 2.2.7 2.2.8 2.2.8.1 2.2.9 2.3.1 2.3.2 2.3.3
codepress-admin-columns / classes / Screen.php
codepress-admin-columns / classes Last commit date
Acf 1 day ago Admin 1 day ago Ajax 1 day ago ApplyFilter 1 day ago Asset 1 day ago Capabilities 1 day ago Check 1 day ago Collection 1 day ago Column 1 day ago ColumnFactories 1 day ago ColumnFactory 1 day ago ColumnIterator 1 day ago ColumnRepository 1 day ago ColumnSize 1 day ago DI 1 day ago DefaultColumnHandler 1 day ago Deprecated 1 day ago Entity 1 day ago Exception 1 day ago Expression 1 day ago Form 1 day ago Formatter 1 day ago Helper 1 day ago Integration 1 day ago ListScreenRepository 1 day ago ListTable 1 day ago Message 1 day ago Meta 1 day ago Nonce 1 day ago Notice 1 day ago Plugin 1 day ago Preferences 1 day ago Promo 1 day ago Request 1 day ago RequestHandler 1 day ago Response 1 day ago Sanitize 1 day ago Service 1 day ago Setting 1 day ago Settings 1 day ago Storage 1 day ago Table 1 day ago TableIdsFactory 1 day ago TableScreen 1 day ago TableScreenFactory 1 day ago ThirdParty 1 day ago Type 1 day ago Value 1 day ago View 1 day ago Acf.php 1 day ago AdminColumns.php 1 day ago ArrayIterator.php 1 day ago Capabilities.php 1 day ago Collection.php 1 day ago CollectionFormatter.php 1 day ago Column.php 1 day ago ColumnCollection.php 1 day ago ColumnFactoryCollectionFactory.php 1 day ago ColumnFactoryDefinitionCollection.php 1 day ago ColumnGroups.php 1 day ago ColumnIterator.php 1 day ago ColumnNamesTrait.php 1 day ago ColumnRepository.php 1 day ago ColumnTypeRepository.php 1 day ago Config.php 1 day ago DateFormats.php 1 day ago DefaultColumnHandler.php 1 day ago Expirable.php 1 day ago Formatter.php 1 day ago FormatterCollection.php 1 day ago Helper.php 1 day ago ListScreen.php 1 day ago ListScreenCollection.php 1 day ago ListScreenRepository.php 1 day ago ListScreenRepositoryWritable.php 1 day ago ListTable.php 1 day ago ListTableFactory.php 1 day ago Loader.php 1 day ago Message.php 1 day ago MetaType.php 1 day ago Middleware.php 1 day ago OpCacheInvalidateTrait.php 1 day ago PluginActionLinks.php 1 day ago PluginActionUpgrade.php 1 day ago PostType.php 1 day ago PostTypeRepository.php 1 day ago Registerable.php 1 day ago Registry.php 1 day ago Renderable.php 1 day ago Request.php 1 day ago RequestAjaxHandler.php 1 day ago RequestAjaxHandlers.php 1 day ago RequestAjaxParser.php 1 day ago RequestHandler.php 1 day ago RequestHandlerFactory.php 1 day ago Screen.php 1 day ago Services.php 1 day ago TableIdsFactory.php 1 day ago TableScreen.php 1 day ago TableScreenFactory.php 1 day ago Taxonomy.php 1 day ago Transient.php 1 day ago TypedArrayIterator.php 1 day ago View.php 1 day ago WooCommerce.php 1 day ago WpListTableFactory.php 1 day ago
Screen.php
125 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace AC;
6
7 use AC\Admin\Page\Columns;
8 use AC\Admin\RequestHandlerInterface;
9 use LogicException;
10 use WP_Screen;
11
12 class Screen implements Registerable
13 {
14 protected ?WP_Screen $screen = null;
15
16 private TableScreenFactory $table_screen_factory;
17
18 public function __construct(TableScreenFactory $table_screen_factory)
19 {
20 $this->table_screen_factory = $table_screen_factory;
21 }
22
23 public function register(): void
24 {
25 add_action('current_screen', [$this, 'init']);
26 }
27
28 public function init(WP_Screen $screen): void
29 {
30 $this->set_screen($screen);
31
32 do_action('ac/screen', $this, $screen->id);
33 }
34
35 public function is_screen(string $id): bool
36 {
37 return $this->has_screen() && $this->get_screen()->id === $id;
38 }
39
40 public function set_screen(WP_Screen $screen): void
41 {
42 $this->screen = $screen;
43 }
44
45 public function get_screen(): WP_Screen
46 {
47 if (! $this->screen instanceof WP_Screen) {
48 throw new LogicException('Screen is not set.');
49 }
50
51 return $this->screen;
52 }
53
54 public function has_screen(): bool
55 {
56 return $this->screen instanceof WP_Screen;
57 }
58
59 public function get_id(): string
60 {
61 return $this->get_screen()->id;
62 }
63
64 public function get_base(): string
65 {
66 return $this->get_screen()->base;
67 }
68
69 public function get_post_type(): string
70 {
71 return $this->get_screen()->post_type;
72 }
73
74 private function is_admin_network(): bool
75 {
76 return $this->get_screen()->in_admin('network');
77 }
78
79 public function is_table_screen(): bool
80 {
81 return $this->table_screen_factory->can_create_from_wp_screen($this->get_screen());
82 }
83
84 public function is_plugin_screen(): bool
85 {
86 $screen = $this->is_admin_network()
87 ? 'plugins-network'
88 : 'plugins';
89
90 return $this->is_screen($screen);
91 }
92
93 public function is_admin_screen(?string $slug = null): bool
94 {
95 if (null !== $slug) {
96 $tabs = [$slug];
97
98 // When the column page is requested from the setting menu the 'tab' querystring is not set.
99 if (Columns::NAME === $slug) {
100 $tabs[] = null;
101 }
102
103 return $this->is_main_admin_screen() && in_array(
104 filter_input(INPUT_GET, RequestHandlerInterface::PARAM_TAB),
105 $tabs,
106 true
107 );
108 }
109
110 return $this->is_main_admin_screen();
111 }
112
113 private function is_main_admin_screen(): bool
114 {
115 $id = 'settings_page_' . Admin\Admin::NAME;
116
117 if ($this->is_admin_network()) {
118 $id .= '-network';
119 }
120
121 return $this->is_screen($id);
122 }
123
124 }
125