Permalinks final readonly class
Minn\Front\Permalinks · public/minn/src/Minn/Front/Permalinks.php · 265 lines
Builds public URLs from the site's permalink structure. With an empty structure every link is a query-string form (?p=, ?cat=); with a structure, published and private posts get their pretty form and every other status keeps the query form, which is what the reference emits.
Used by 50 (show)
Constants and properties
| private | QUERY_ONLY = array ( 0 => 'wp_pattern_category', 1 => 'wp_theme', 2 => 'wp_template_part_area', ) | Core taxonomies with no front-end archive: their terms link by query only. |
| private | readonly Minn\Content\Posts $posts | Promoted from the constructor. |
| private | readonly Minn\Content\Terms $terms | Promoted from the constructor. |
| prop | readonly string $home | Promoted from the constructor. |
| prop | readonly string $structure | Promoted from the constructor. |
| prop | readonly int $frontPageId | Promoted from the constructor. |
| prop | readonly int $postsPageId | Promoted from the constructor. |
| private | readonly ?Closure $registry | Promoted from the constructor. |
Public
| new | __construct(Minn\Content\Posts $posts, Minn\Content\Terms $terms, string $home, string $structure, int $frontPageId = 0, int $postsPageId = 0, ?Closure $registry = NULL)# | |
| method | typeSlug(string $type): string# | The rewrite slug a plugin gave its post type, else the type's name. |
| method | taxonomySlug(string $taxonomy): ?string# | The rewrite slug a plugin gave its taxonomy; null for one the engine does not know. |
| method | forPostTypeArchive(array $type): string# | A post type archive's address: its has_archive slug, or the type's slug when has_archive is true. |
| static | fromDb(Minn\Db $db): self# | Link building from the site's own settings. |
| method | isPretty(): bool# | Whether the site uses a permalink structure. |
| method | url(string $path = ''): string# | A URL under the home. |
| static | feedPath(string $base, string $type): string# | A feed's address under a base path ("/", "/category/news/", "/hello-world/"): feed/ for the default feed (rss2, and rss with it), feed/<type>/ for another; a comments-<type> feed is its <type>. |
| method | link(Minn\Content\PostRecord $post): string# | A post's link as plugins and clients are given it: once the runtime runs, the reference's, through its link filters (post_link, page_link, post_type_link, as get_permalink() answers); before, the engine's own. |
| method | forComment(int $commentId, ?Minn\Content\PostRecord $post, int $postId): string# | A comment's link as plugins and clients are given it: once the runtime runs, get_comment_link()'s (its paging and its filter, over the post's filtered link); before, the post's own with the anchor. |
| method | forPost(Minn\Content\PostRecord $post): string# | A post's permalink, by the engine's own rules (no plugin filters: address matching uses it). |
| method | forPage(Minn\Content\PostRecord $page): string# | A page's permalink, the home for the front page. |
| method | pagePath(Minn\Content\PostRecord $page): string# | A page's own pretty path, even for the static front page (its comments feed lives there). |
| method | forAttachment(Minn\Content\PostRecord $attachment): string# | An attachment's public link: its slug under the parent's permalink when attached, at the root when not, or the query form under plain permalinks. |
| method | forTerm(Minn\Content\TermRecord $term): string# | A term's archive URL. |
| method | forAuthor(Minn\Content\UserRecord $user): string# | An author's archive URL. |
| method | forDate(int $year, ?int $month = NULL, ?int $day = NULL): string# | A date archive's URL. |
| method | forSearch(string $term): string# | A search's URL. |
| method | forPaged(string $baseUrl, int $page): string# | A listing URL for a page number. |
Internals 3
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
Nothing matches.