PluginProbe
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel / 1.8.0
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel v1.8.0
1.8.0 1.7.1 1.7.0 1.6.0 1.5.2 trunk 0.1 0.2.0 0.2.1 0.3 0.3.1 0.3.2 0.3.3 0.3.4 0.4 0.4.1 0.4.2 0.4.3 1.0 1.1 1.2 1.3.1 1.4.0 1.4.1 1.5.0 All 27 releases
flywp / includes / StaticSite / Engine / Discovery / WordPressGateway.php

WordPressGateway.php in FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel 1.8.0, at includes/StaticSite/Engine/Discovery/WordPressGateway.php

333 lines 8.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FlyWP\StaticSite\Engine\Discovery;
4
5 /**
6 * All WordPress data that discovery and the change log read.
7 *
8 * The URL rules and the hook handlers use only this interface. Thus they run in PHPUnit without WordPress.
9 *
10 * @since 1.8.0
11 */
12 interface WordPressGateway {
13
14 /**
15 * @return string Home URL with a trailing slash.
16 */
17 public function home_url();
18
19 /**
20 * @param string $name Option name.
21 *
22 * @return mixed
23 */
24 public function option( $name );
25
26 /**
27 * @param string $hook Filter name.
28 * @param mixed $value Value to filter.
29 * @param mixed $arg Extra argument.
30 *
31 * @return mixed
32 */
33 public function apply_filters( $hook, $value, $arg = null );
34
35 /**
36 * @return bool True during an import (WP_IMPORTING) or an install.
37 */
38 public function is_bulk_request();
39
40 /**
41 * @return string[] Public post types, without attachment.
42 */
43 public function public_post_types();
44
45 /**
46 * @return string[] Public taxonomies.
47 */
48 public function public_taxonomies();
49
50 /**
51 * Published posts with an ID higher than $after_id, in ID order.
52 *
53 * @param string[] $post_types Post types.
54 * @param int $after_id Last ID of the previous batch.
55 * @param int $limit Batch size.
56 *
57 * @return array<int, array{id:int, post_type:string, password:string, modified_gmt:string}>
58 */
59 public function post_rows( array $post_types, $after_id, $limit );
60
61 /**
62 * SEO robots meta rows of the posts. Only for SEO plugins that are active.
63 *
64 * @param int[] $post_ids Post IDs.
65 *
66 * @return array<int, array{post_id:int, meta_key:string, meta_value:string}>
67 */
68 public function seo_robots_meta( array $post_ids );
69
70 /**
71 * Yoast SEO term meta option (wpseo_taxonomy_meta). Empty when Yoast SEO is not active.
72 *
73 * @return array<string, array<int, array<string, string>>>
74 */
75 public function seo_term_meta_option();
76
77 /**
78 * Rank Math term robots meta with a term ID higher than $after_id, in ID order. Empty when Rank Math is not active.
79 *
80 * @param int $after_id Last term ID of the previous batch.
81 * @param int $limit Batch size.
82 *
83 * @return array<int, array{term_id:int, taxonomy:string, meta_value:string}>
84 */
85 public function seo_term_robots_meta( $after_id, $limit );
86
87 /**
88 * @param int $post_id Post ID.
89 *
90 * @return array{id:int, post_type:string, status:string, password:string, author:int, date:string, modified_gmt:string, pages:int}|null
91 * "pages" is the number of <!--nextpage--> pages.
92 */
93 public function post( $post_id );
94
95 /**
96 * @param int $post_id Post ID.
97 *
98 * @return string|null
99 */
100 public function permalink( $post_id );
101
102 /**
103 * Permalink of a post object as it is, for example the object before an update.
104 *
105 * @param object $post Post object.
106 *
107 * @return string|null
108 */
109 public function object_permalink( $post );
110
111 /**
112 * @param string $permalink Post permalink.
113 * @param int $page Page number of a <!--nextpage--> post.
114 *
115 * @return string
116 */
117 public function post_page_url( $permalink, $page );
118
119 /**
120 * @param int $post_id Post ID.
121 * @param string $post_type Post type.
122 *
123 * @return bool True when the post type is hierarchical and the post has published children.
124 */
125 public function post_has_children( $post_id, $post_type );
126
127 /**
128 * @param string $post_type Post type.
129 *
130 * @return int Number of published posts.
131 */
132 public function published_count( $post_type );
133
134 /**
135 * @param string[] $post_types Post types.
136 *
137 * @return string|null Newest post_modified_gmt of published posts.
138 */
139 public function newest_modified_gmt( array $post_types );
140
141 /**
142 * @param string $post_type Post type.
143 *
144 * @return string|null
145 */
146 public function post_type_archive_link( $post_type );
147
148 /**
149 * Terms that have posts or child terms, with an ID higher than $after_id, in ID order.
150 *
151 * @param string $taxonomy Taxonomy.
152 * @param int $after_id Last ID of the previous batch.
153 * @param int $limit Batch size.
154 *
155 * @return array<int, array{id:int, taxonomy:string, count:int}>
156 */
157 public function term_rows( $taxonomy, $after_id, $limit );
158
159 /**
160 * @param int $term_id Term ID.
161 *
162 * @return array{id:int, taxonomy:string, count:int}|null
163 */
164 public function term( $term_id );
165
166 /**
167 * @param int $tt_id Term taxonomy ID.
168 * @param string $taxonomy Taxonomy.
169 *
170 * @return array{id:int, taxonomy:string, count:int}|null
171 */
172 public function term_by_tt_id( $tt_id, $taxonomy );
173
174 /**
175 * Terms of the post in all public taxonomies.
176 *
177 * @param int $post_id Post ID.
178 *
179 * @return array<int, array{id:int, taxonomy:string, count:int}>
180 */
181 public function post_terms( $post_id );
182
183 /**
184 * @param int $term_id Term ID.
185 * @param string $taxonomy Taxonomy.
186 *
187 * @return string|null
188 */
189 public function term_link( $term_id, $taxonomy );
190
191 /**
192 * @param int $term_id Term ID.
193 * @param string $taxonomy Taxonomy.
194 *
195 * @return bool True when the taxonomy is hierarchical and the term has child terms.
196 */
197 public function term_has_children( $term_id, $taxonomy );
198
199 /**
200 * @param string $post_type Post type.
201 * @param string $taxonomy Taxonomy.
202 *
203 * @return bool
204 */
205 public function object_in_taxonomy( $post_type, $taxonomy );
206
207 /**
208 * Authors that have published posts of the type "post", with a user ID higher than $after_id, in ID order.
209 *
210 * @param int $after_id Last user ID of the previous batch.
211 * @param int $limit Batch size.
212 *
213 * @return array<int, array{id:int, count:int, modified_gmt:string}>
214 */
215 public function author_rows( $after_id, $limit );
216
217 /**
218 * @param int $user_id User ID.
219 *
220 * @return int Published posts of the type "post".
221 */
222 public function author_post_count( $user_id );
223
224 /**
225 * @param int $user_id User ID.
226 *
227 * @return string|null
228 */
229 public function author_link( $user_id );
230
231 /**
232 * Months with published posts of the type "post", newest first, older than $before_key.
233 *
234 * @param int $before_key Year * 100 + month of the last row of the previous batch. 0 for the first batch.
235 * @param int $limit Batch size.
236 *
237 * @return array<int, array{year:int, month:int}>
238 */
239 public function month_rows( $before_key, $limit );
240
241 /**
242 * @param int $year Year.
243 * @param int $month Month, or 0 for the full year.
244 *
245 * @return int Published posts of the type "post" in the period.
246 */
247 public function date_post_count( $year, $month );
248
249 /**
250 * @param int $year Year.
251 *
252 * @return string
253 */
254 public function year_link( $year );
255
256 /**
257 * @param int $year Year.
258 * @param int $month Month.
259 *
260 * @return string
261 */
262 public function month_link( $year, $month );
263
264 /**
265 * @param string $feed Empty for the main feed, "comments_" for the comments feed.
266 *
267 * @return string
268 */
269 public function feed_link( $feed = '' );
270
271 /**
272 * @param string $base_url Page 1 URL.
273 * @param int $page Page number.
274 *
275 * @return string
276 */
277 public function paged_url( $base_url, $page );
278
279 /**
280 * @param int $comment_id Comment ID.
281 *
282 * @return array{post_id:int, approved:string}|null
283 */
284 public function comment( $comment_id );
285
286 /**
287 * @param int $post_id Post ID.
288 * @param bool $top_level_only Count only comments without a parent.
289 *
290 * @return int
291 */
292 public function approved_comment_count( $post_id, $top_level_only );
293
294 /**
295 * @param string $permalink Post permalink.
296 * @param int $page Comment page number.
297 *
298 * @return string
299 */
300 public function comment_page_url( $permalink, $page );
301
302 /**
303 * @param int $attachment_id Attachment ID.
304 *
305 * @return string|null URL of the attached file.
306 */
307 public function attachment_file_url( $attachment_id );
308
309 /**
310 * @param int $attachment_id Attachment ID.
311 *
312 * @return array Attachment metadata ("sizes", "original_image").
313 */
314 public function attachment_metadata( $attachment_id );
315
316 /**
317 * Sitemap index, sub-sitemaps and stylesheets that WordPress or an active SEO plugin serves.
318 *
319 * @return string[]
320 */
321 public function sitemap_urls();
322
323 /**
324 * @return string[]
325 */
326 public function site_icon_urls();
327
328 /**
329 * @return string[] style.css of the active theme and of its parent theme.
330 */
331 public function theme_stylesheet_urls();
332 }
333