API / Minn\Runtime / PostLookup

PostLookup final readonly class

Minn\Runtime\PostLookup · public/minn/src/Minn/Runtime/PostLookup.php · 134 lines

The post reads plugin code asks for by shape: a page by title, revisions, counts.

Uses 1

Constants and properties

privatereadonly Minn\Db $db

Promoted from the constructor.

Public

new__construct(Minn\Db $db)#
methodidByTitle(string $title, array $types): ?int#

The id of a post with this title among the types, or null.

$typeslist<string>
methodrevisionsOf(int $postId): array#

Revision rows newest first. @return list<array<string, mixed>>

@return list<array<string, mixed>>
methodcountByStatus(string $type): array#

How many posts of a type there are per status.

@return array<string, int> status => count
methodcountAttachments(): array#

How many attachments there are per mime type.

@return array<string, int> mime type => count, plus 'trash'
methodcountByAuthor(int $userId, array $types, array $statuses): int#

How many posts an author has among the types and statuses.

$typeslist<string>@param list<string> $statuses
methodcountsByAuthors(array $userIds, array $types, array $statuses): array#

Post counts for several authors at once, as stored (strings), for those that have any.

$userIdslist<int>
$typeslist<string>
$statuseslist<string>
@return array<int, string>
methodpublishingAuthors(string $type, int $limit): int#

How many authors (up to a limit) have published posts of a type, for is_multi_author.

methodcountsByAuthor(array $types, array $statuses, int $viewer): array#

Post counts by author for wp_list_authors: the types' posts in the statuses given, and the private ones of the viewer (an id, or -1 for none) beside them.

$typeslist<string>@param list<string> $statuses
@return array<int, int>
methodidsByAuthor(int $userId): array#

Every post id of an author.

@return list<int>
methodattachmentIdByFile(string $path): ?int#

The attachment whose stored file path is the given one.