private function setup()
{
if (!function_exists('jetpack_photon_url')) {
return;
}
// Images in post content and galleries
add_filter('the_content', array(__CLASS__, 'filter_the_content'), 999999);
add_filter('get_post_galleries', array(__CLASS__, 'filter_the_galleries'), 999999);
// Core image retrieval
add_filter('image_downsize', array($this, 'filter_image_downsize'), 10, 3);
// Responsive image srcset substitution
add_filter('wp_calculate_image_srcset', array($this, 'filter_srcset_array'), 10, 4);
add_filter('wp_calculate_image_sizes', array($this, 'filter_sizes'), 1, 2);
// Early so themes can still easily filter.
// Helpers for maniuplated images
add_action('wp_enqueue_scripts', array($this, 'action_wp_enqueue_scripts'), 9);
}