jetpack
Last commit date
3rd-party
2 months ago
_inc
2 weeks ago
css
2 weeks ago
extensions
2 weeks ago
images
1 month ago
jetpack_vendor
2 weeks ago
json-endpoints
2 weeks ago
modules
2 weeks ago
sal
2 weeks ago
src
4 weeks ago
vendor
2 weeks ago
views
1 month ago
CHANGELOG.md
2 weeks ago
LICENSE.txt
5 months ago
SECURITY.md
2 years ago
class-jetpack-connection-status.php
2 years ago
class-jetpack-gallery-settings.php
6 months ago
class-jetpack-newsletter-dashboard-widget.php
6 months ago
class-jetpack-pre-connection-jitms.php
2 years ago
class-jetpack-stats-dashboard-widget.php
3 months ago
class-jetpack-xmlrpc-methods.php
6 months ago
class.frame-nonce-preview.php
6 months ago
class.jetpack-admin.php
1 month ago
class.jetpack-autoupdate.php
6 months ago
class.jetpack-cli.php
5 months ago
class.jetpack-client-server.php
2 years ago
class.jetpack-gutenberg.php
2 months ago
class.jetpack-heartbeat.php
3 months ago
class.jetpack-modules-list-table.php
6 months ago
class.jetpack-network-sites-list-table.php
6 months ago
class.jetpack-network.php
1 month ago
class.jetpack-plan.php
2 years ago
class.jetpack-post-images.php
2 months ago
class.jetpack-twitter-cards.php
3 months ago
class.jetpack-user-agent.php
2 years ago
class.jetpack.php
3 weeks ago
class.json-api-endpoints.php
2 weeks ago
class.json-api.php
2 weeks ago
class.photon.php
3 years ago
composer.json
2 weeks ago
enhanced-open-graph.php
3 months ago
functions.compat.php
3 months ago
functions.cookies.php
2 years ago
functions.global.php
1 month ago
functions.is-mobile.php
2 years ago
functions.opengraph.php
2 months ago
functions.photon.php
2 years ago
jetpack.php
2 weeks ago
json-api-config.php
3 years ago
json-endpoints.php
2 years ago
load-jetpack.php
2 months ago
locales.php
6 months ago
readme.txt
2 weeks ago
unauth-file-upload.php
6 months ago
uninstall.php
6 months ago
wpml-config.xml
3 years ago
functions.photon.php
81 lines
| 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 | } |
| 81 |