PluginProbe ʕ •ᴥ•ʔ
Admin Columns / 4.7.20
Admin Columns v4.7.20
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 / api.php
codepress-admin-columns Last commit date
assets 6 months ago classes 6 months ago languages 6 months ago settings 6 months ago templates 6 months ago vendor 6 months ago api.php 6 months ago codepress-admin-columns.php 6 months ago readme.txt 6 months ago
api.php
191 lines
1 <?php
2
3 use AC\Container;
4 use AC\Helper;
5 use AC\ListScreen;
6 use AC\ListScreenCollection;
7 use AC\Type\ListScreenId;
8 use AC\Type\Url;
9
10 function ac_get_url(string $relative_file_path): string
11 {
12 return Container::get_location()->with_suffix($relative_file_path)->get_url();
13 }
14
15 if ( ! function_exists('AC')) {
16 function AC(): AC\AdminColumns
17 {
18 static $ac = null;
19
20 if ($ac === null) {
21 $ac = new AC\AdminColumns();
22 }
23
24 return $ac;
25 }
26 }
27
28 if ( ! function_exists('ac_helper')) {
29 function ac_helper(): AC\Helper
30 {
31 return new AC\Helper();
32 }
33 }
34
35 /**
36 * @since 4.0.0
37 */
38 if ( ! function_exists('ac_get_list_screen')) {
39 function ac_get_list_screen(string $id): ?ListScreen
40 {
41 return Container::get_storage()->find(new ListScreenId($id));
42 }
43 }
44
45 /**
46 * Usage: Load after or within the 'wp_loaded' action hook.
47 * @since 4.0.0
48 */
49 if ( ! function_exists('ac_get_list_screens')) {
50 function ac_get_list_screens(string $key): ListScreenCollection
51 {
52 return Container::get_storage()->find_all_by_key($key);
53 }
54 }
55
56 /**
57 * Usage: Load after or within the 'wp_loaded' action hook.
58 */
59 if ( ! function_exists('ac_get_column')) {
60 function ac_get_column(string $column_name, string $list_screen_id): ?\AC\Column
61 {
62 try {
63 $list_id = new ListScreenId($list_screen_id);
64 } catch (Exception $e) {
65 return null;
66 }
67
68 $list_screen = Container::get_storage()->find($list_id);
69
70 if ( ! $list_screen) {
71 return null;
72 }
73
74 $column = $list_screen->get_column_by_name($column_name);
75
76 return $column ?: null;
77 }
78 }
79
80 /**
81 * Usage: Load after or within the 'wp_loaded' action hook.
82 * @return AC\Column[]
83 * @since 4.2
84 */
85 if ( ! function_exists('ac_get_columns')) {
86 function ac_get_columns(string $list_screen_id): array
87 {
88 try {
89 $list_id = new ListScreenId($list_screen_id);
90 } catch (Exception $e) {
91 return [];
92 }
93
94 $list_screen = Container::get_storage()->find($list_id);
95
96 if ( ! $list_screen) {
97 return [];
98 }
99
100 return $list_screen->get_columns();
101 }
102 }
103
104 if ( ! function_exists('ac_format_date')) {
105 function ac_format_date(string $format, int $timestamp = null, DateTimeZone $timezone = null): ?string
106 {
107 return (new Helper\Date())->format_date($format, $timestamp, $timezone) ?: null;
108 }
109 }
110
111 function ac_get_admin_url(string $slug = null): string
112 {
113 _deprecated_function(__METHOD__, '4.5', 'Url\Editor');
114
115 return (new Url\Editor($slug))->get_url();
116 }
117
118 function ac_get_admin_network_url(string $slug = null): string
119 {
120 _deprecated_function(__METHOD__, '4.5', 'Url\EditorNetwork');
121
122 return (new Url\EditorNetwork($slug))->get_url();
123 }
124
125 function ac_register_columns(): void
126 {
127 _deprecated_function(__METHOD__, '4.0');
128 }
129
130 function ac_get_site_utm_url(
131 string $path,
132 string $utm_medium,
133 string $utm_content = null,
134 string $utm_campaign = null
135 ): string {
136 _deprecated_function(__METHOD__, '6.0', 'AC\Type\UrlUtmTags()');
137
138 return (new Url\UtmTags(new Url\Site($path), $utm_medium, $utm_content, $utm_campaign))->get_url();
139 }
140
141 function ac_get_site_documentation_url(string $path = null): string
142 {
143 _deprecated_function(__METHOD__, '6.0', 'AC\Type\Url\Documentation()');
144
145 return (new Url\Documentation($path))->get_url();
146 }
147
148 function ac_get_site_url(string $path = null): string
149 {
150 _deprecated_function(__METHOD__, '6.0', 'AC\Type\Url\Site()');
151
152 return (new Url\Site($path))->get_url();
153 }
154
155 if ( ! function_exists('ac_load_columns')) {
156 function ac_load_columns(): void
157 {
158 _deprecated_function(__METHOD__, '4.1');
159 }
160 }
161
162 function ac_is_pro_active(): bool
163 {
164 _deprecated_function(__METHOD__, '6.0');
165
166 return defined('ACP_FILE');
167 }
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191