PHP Class Jetpack_Media_Meta_Extractor, jetpack

ファイルを表示 Open project: automattic/jetpack Class Usage Examples

Public Methods

Method Description
build_image_struct ( $image_list )
extract ( $blog_id, $post_id, $what_to_extract = self::ALL ) Gets the specified media and meta info from the given post.
extract_from_content ( $content, $what_to_extract = self::ALL, $already_extracted = [] ) Gets the specified meta info from the given post content.
extract_images_from_content ( $content, $image_list )
get_images_from_html ( string $html, array $images_already_extracted ) : array

Private Methods

Method Description
get_image_fields ( $post, $args = [] )
get_stripped_content ( $content )

Method Details

build_image_struct() public static method

public static build_image_struct ( $image_list )

extract() public static method

NOTE: If you have the post's HTML content already and don't need image data, use extract_from_content() instead.
public static extract ( $blog_id, $post_id, $what_to_extract = self::ALL )
$blog_id The ID of the blog
$post_id The ID of the post
$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() public static method

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.
public static extract_from_content ( $content, $what_to_extract = self::ALL, $already_extracted = [] )
$content The HTML post_content of a post
$what_to_extract (int) A mask of things to extract, e.g. Jetpack_Media_Meta_Extractor::IMAGES | Jetpack_Media_Meta_Extractor::MENTIONS
$already_extracted (array) Previously extracted things, e.g. images from extract(), which can be used for x-referencing here

extract_images_from_content() public static method

public static extract_images_from_content ( $content, $image_list )

get_images_from_html() public static method

public static get_images_from_html ( string $html, array $images_already_extracted ) : array
$html string Some markup, possibly containing image tags
$images_already_extracted array (just an array of image URLs without query strings, no special structure), used for de-duplication
return array Image URLs extracted from the HTML, stripped of query params and de-duped