Properties

$extensions

$extensions

$image_sizes

$image_sizes

$__instance

$__instance

Methods

instance()

instance() : object

Singleton implementation

Returns

object

action_jetpack_activate_module_photon()

action_jetpack_activate_module_photon() : null

Check if site is private and warn user if it is

Returns

null

parse_images_from_html()

parse_images_from_html(string $content) : array

Match all images and any relevant <a> tags in a block of HTML.

Parameters

string $content

Some HTML.

Returns

array —

An array of $images matches, where $images[0] is

    an array of full matches, and the link_url, img_tag,
    and img_url keys are arrays of those matches.

parse_dimensions_from_filename()

parse_dimensions_from_filename(string $src) : array

Try to determine height and width from strings WP appends to resized image filenames.

Parameters

string $src

The image URL.

Returns

array —

An array consisting of width and height.

filter_the_content()

filter_the_content(string $content) : string

Identify images in post content, and if images are local (uploaded to the current site), pass through Photon.

Parameters

string $content

Returns

string

filter_image_downsize()

filter_image_downsize(string|bool $image, int $attachment_id, string|array $size) : string|bool

Filter post thumbnail image retrieval, passing images through Photon

Parameters

string|bool $image
int $attachment_id
string|array $size

Returns

string|bool

filter_open_graph_tags()

filter_open_graph_tags(array $tags, array $parameters) : array

Pass og:image URLs through Photon

Parameters

array $tags
array $parameters

Returns

array

action_wp_enqueue_scripts()

action_wp_enqueue_scripts() : null

Enqueue Photon helper script

Returns

null

validate_image_url()

validate_image_url(string $url) : bool

Ensure image URL is valid for Photon.

Though Photon functions address some of the URL issues, we should avoid unnecessary processing if we know early on that the image isn't supported.

Parameters

string $url

Returns

bool

image_sizes()

image_sizes() : array

Provide an array of available image sizes and corresponding dimensions.

Similar to get_intermediate_image_sizes() except that it includes image sizes' dimensions, not just their names.

Returns

array

__construct()

__construct()

Silence is golden.

setup()

setup() : null

Register actions and filters, but only if basic Photon functions are available.

The basic functions are found in ./functions.photon.php.

Returns

null