API / Minn\Front / PostEmbed

PostEmbed final class

Minn\Front\PostEmbed · public/minn/src/Minn/Front/PostEmbed.php · 106 lines

A post as other sites embed it, the oEmbed provider side, as the reference answers (probe oembed): the data (version, the site as provider, the author or else the site, the title) through oembed_response_data, whose default makes it "rich" with the embed markup: a blockquote linking the post, a sandboxed iframe of its /embed/ page carrying a fresh secret, and the inline script that sizes it. Only a publicly viewable post is embeddable; the width is held between 200 and 600 (oembed_min_max_width) and the height is a 16:9 share of it, at least 200.

Public

staticdata(mixed $post, int $width): array|false#

get_oembed_response_data: the data, or false when the post cannot be embedded. @return array<string, mixed>|false

@return array<string, mixed>|false
staticrich(array $data, WP_Post $post, int $width, int $height): array#

get_oembed_response_data_rich: the size, the markup, and a thumbnail when the post has one. @param array<string, mixed> $data @return array<string, mixed>

$dataarray<string, mixed>@return array<string, mixed>
statichtml(int $width, int $height, mixed $post): string|false#

get_post_embed_html: the blockquote, the iframe and its script, through embed_html; false for no post.

staticurl(mixed $post): string|false#

get_post_embed_url: the post's /embed/ address (?embed=true without pretty links), through post_embed_url.

staticxml(array $data, ?SimpleXMLElement $root = NULL): string#

_oembed_create_xml: the data as an oembed document (or under the root given), nested arrays as nested elements. @param array<string, mixed> $data

$dataarray<string, mixed>

Internals 1

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privateappend(SimpleXMLElement $node, array $data): void#
$dataarray<string, mixed>