API / Minn\Runtime / RewriteStructs

RewriteStructs final class

Minn\Runtime\RewriteStructs · public/minn/src/Minn/Runtime/RewriteStructs.php · 113 lines

The rewrite object's state and the structures it builds links and rules from (probe db-mail-rewrite-doubts): init reads the permalink structure and clears the bottom, external and endpoint rules while the top rules stay; each structure (date, author, search, page, feed, comment feed) is the one already set on the object when there is one, else made once and kept; year and month come from the date structure with its empty steps folded; a removed tag leaves its place empty.

Constants and properties

privateMADE = array ( 'author' => array ( 0 => 'author_structure', 1 => 'front', 2 => array ( 0 => 'author_base', ), 3 => '/%author%', ), 'search' => array ( 0 => 'search_structure', 1 => 'root', 2 => array ( 0 => 'search_base', ), 3 => '/%search%', ), 'page' => array ( 0 => 'page_structure', 1 => 'root', 2 => array ( ), 3 => '%pagename%', ), 'feed' => array ( 0 => 'feed_structure', 1 => 'root', 2 => array ( 0 => 'feed_base', ), 3 => '/%feed%', ), 'comment_feed' => array ( 0 => 'comment_feed_structure', 1 => 'root', 2 => array ( 0 => 'comments_base', 1 => 'feed_base', ), 3 => '/%feed%', ), )

The structure each getter keeps, by name, and how it is made from the front or the root.

Public

staticinit(Minn\Objects\Rewrite $rewrite): void#

The object set up from the stored permalink structure (WP_Rewrite::init).

staticdate(Minn\Objects\Rewrite $rewrite): string|false#

The date structure: the one set, else the structure's own order of year, month and day (under date/ when a post id is among its first three tags, as it would read as a date); false without permalinks.

staticdateWithout(Minn\Objects\Rewrite $rewrite, array $tags): string|false#

The date structure without the given tags, its empty steps folded into one slash.

staticmade(Minn\Objects\Rewrite $rewrite, string $name): string|false#

One of the named structures (author, search, page, feed, comment_feed): the one set, else made once and kept; false without permalinks.

staticremoveTag(Minn\Objects\Rewrite $rewrite, mixed $tag): void#

A rewrite tag removed, its place in each list left empty.

staticpermastruct(Minn\Objects\Rewrite $rewrite, mixed $struct, array $legacy): array#

A permanent structure's arguments: an array as given, or the old signature's with_front and ep_mask, over the defaults; the structure under the front or the root.

$legacylist<mixed>the arguments after the structure, as given
@return array<string, mixed>
staticsetBase(Minn\Objects\Rewrite $rewrite, string $option, mixed $value): void#

Sets a base option and starts the object over, only when the value changes.