\Jetpack_Media_Meta_Extractor

Class with methods to extract metadata from a post/page about videos, images, links, mentions embedded in or attached to the post/page.

Summary

Methods
Properties
Constants
extract()
extract_from_content()
get_images_from_html()
No public properties found
ALL
LINKS
MENTIONS
IMAGES
SHORTCODES
EMBEDS
HASHTAGS
No protected methods found
No protected properties found
N/A
get_image_fields()
get_stripped_content()
$KEEPER_SHORTCODES
N/A

Constants

ALL

ALL

MENTIONS

MENTIONS

IMAGES

IMAGES

SHORTCODES

SHORTCODES

EMBEDS

EMBEDS

HASHTAGS

HASHTAGS

Properties

$KEEPER_SHORTCODES

$KEEPER_SHORTCODES

Methods

extract()

extract(mixed $blog_id, mixed $post_id, mixed $what_to_extract)

Gets the specified media and meta info from the given post.

NOTE: If you have the post's HTML content already and don't need image data, use extract_from_content() instead.

Parameters

mixed $blog_id

The ID of the blog

mixed $post_id

The ID of the post

mixed $what_to_extract

(int) A mask of things to extract, e.g. Jetpack_Media_Meta_Extractor::IMAGES | Jetpack_Media_Meta_Extractor::MENTIONS

extract_from_content()

extract_from_content(mixed $content, mixed $what_to_extract, mixed $already_extracted)

Gets the specified meta info from the given post content.

NOTE: If you want IMAGES, call extract( $blog_id, $post_id, ...) which will give you more/better image extraction This method will give you an error if you ask for IMAGES.

Parameters

mixed $content

The HTML post_content of a post

mixed $what_to_extract

(int) A mask of things to extract, e.g. Jetpack_Media_Meta_Extractor::IMAGES | Jetpack_Media_Meta_Extractor::MENTIONS

mixed $already_extracted

(array) Previously extracted things, e.g. images from extract(), which can be used for x-referencing here

get_images_from_html()

get_images_from_html(string $html, array $images_already_extracted) : array

Parameters

string $html

Some markup, possibly containing image tags

array $images_already_extracted

(just an array of image URLs without query strings, no special structure), used for de-duplication

Returns

array —

Image URLs extracted from the HTML, stripped of query params and de-duped

get_image_fields()

get_image_fields(mixed $post, mixed $args)

Parameters

mixed $post

A post object

mixed $args

(array) Optional args, see defaults list for details

get_stripped_content()

get_stripped_content( $content)

Parameters

$content