Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
|
100.00% |
5 / 5 |
CRAP | n/a |
0 / 0 |
||
| jetpack_photon_url | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| jetpack_photon_parse_wpcom_query_args | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| jetpack_photon_url_scheme | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| jetpack_photon_banned_domains | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| jetpack_photon_support_text_widgets | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| 1 | <?php // phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase |
| 2 | /** |
| 3 | * Generic functions using the Photon service. |
| 4 | * |
| 5 | * Some are used outside of the Photon module being active, so intentionally not within the module. |
| 6 | * As photon has been moved to the image-cdn package, the functions are now also replaced by their counterparts in Image_CDN_Core in the package. |
| 7 | * |
| 8 | * @package automattic/jetpack |
| 9 | */ |
| 10 | |
| 11 | use Automattic\Jetpack\Image_CDN\Image_CDN; |
| 12 | use Automattic\Jetpack\Image_CDN\Image_CDN_Core; |
| 13 | |
| 14 | /** |
| 15 | * Generates a Photon URL. |
| 16 | * |
| 17 | * @see https://developer.wordpress.com/docs/photon/ |
| 18 | * |
| 19 | * @deprecated 12.2 Use Automattic\Jetpack\Image_CDN\Image_CDN_Core::cdn_url instead. |
| 20 | * @param string $image_url URL to the publicly accessible image you want to manipulate. |
| 21 | * @param array|string $args An array of arguments, i.e. array( 'w' => '300', 'resize' => array( 123, 456 ) ), or in string form (w=123&h=456). |
| 22 | * @param string|null $scheme URL protocol. |
| 23 | * @return string The raw final URL. You should run this through esc_url() before displaying it. |
| 24 | */ |
| 25 | function jetpack_photon_url( $image_url, $args = array(), $scheme = null ) { |
| 26 | return Image_CDN_Core::cdn_url( $image_url, $args, $scheme ); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Parses WP.com-hosted image args to replicate the crop. |
| 31 | * |
| 32 | * @deprecated 12.2 Use Automattic\Jetpack\Image_CDN\Image_CDN_Core::parse_wpcom_query_args instead. |
| 33 | * @param mixed $args Args set during Photon's processing. |
| 34 | * @param string $image_url URL of the image. |
| 35 | * @return array|string Args for Photon to use for the URL. |
| 36 | */ |
| 37 | function jetpack_photon_parse_wpcom_query_args( $args, $image_url ) { |
| 38 | return Image_CDN_Core::parse_wpcom_query_args( $args, $image_url ); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Sets the scheme for a URL |
| 43 | * |
| 44 | * @deprecated 12.2 Use Automattic\Jetpack\Image_CDN\Image_CDN_Core::cdn_url_scheme instead. |
| 45 | * @param string $url URL to set scheme. |
| 46 | * @param string $scheme Scheme to use. Accepts http, https, network_path. |
| 47 | * |
| 48 | * @return string URL. |
| 49 | */ |
| 50 | function jetpack_photon_url_scheme( $url, $scheme ) { |
| 51 | _deprecated_function( __FUNCTION__, 'jetpack-12.2', 'Automattic\Jetpack\Image_CDN\Image_CDN_Core::cdn_url_scheme' ); |
| 52 | return Image_CDN_Core::cdn_url_scheme( $url, $scheme ); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Check to skip Photon for a known domain that shouldn't be Photonized. |
| 57 | * |
| 58 | * @deprecated 12.2 Use Automattic\Jetpack\Image_CDN\Image_CDN_Core::banned_domains instead. |
| 59 | * @param bool $skip If the image should be skipped by Photon. |
| 60 | * @param string $image_url URL of the image. |
| 61 | * |
| 62 | * @return bool Should the image be skipped by Photon. |
| 63 | */ |
| 64 | function jetpack_photon_banned_domains( $skip, $image_url ) { |
| 65 | _deprecated_function( __FUNCTION__, 'jetpack-12.2', 'Automattic\Jetpack\Image_CDN\Image_CDN_Core::banned_domains' ); |
| 66 | return Image_CDN_Core::banned_domains( $skip, $image_url ); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Jetpack Photon - Support Text Widgets. |
| 71 | * |
| 72 | * @deprecated 12.2 |
| 73 | * @access public |
| 74 | * @param string $content Content from text widget. |
| 75 | * @return string |
| 76 | */ |
| 77 | function jetpack_photon_support_text_widgets( $content ) { |
| 78 | _deprecated_function( __FUNCTION__, 'jetpack-12.2' ); |
| 79 | return Image_CDN::filter_the_content( $content ); |
| 80 | } |