diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2017-04-16 04:35:35 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2017-04-16 04:35:35 -0400 |
commit | 38a805d24a890dea4b5e90851693afb4e2041c9e (patch) | |
tree | 5f4b08ad64e6750936303d18abc370851e0db260 /plugins/jetpack/class.photon.php | |
parent | Update plugin wordpress-mobile-pack 2.2.9 (diff) | |
download | blogs-gentoo-38a805d24a890dea4b5e90851693afb4e2041c9e.tar.gz blogs-gentoo-38a805d24a890dea4b5e90851693afb4e2041c9e.tar.bz2 blogs-gentoo-38a805d24a890dea4b5e90851693afb4e2041c9e.zip |
Update jetpack 4.8.2
Diffstat (limited to 'plugins/jetpack/class.photon.php')
-rw-r--r-- | plugins/jetpack/class.photon.php | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/plugins/jetpack/class.photon.php b/plugins/jetpack/class.photon.php index a74e6cdb..87a0f8c3 100644 --- a/plugins/jetpack/class.photon.php +++ b/plugins/jetpack/class.photon.php @@ -403,17 +403,18 @@ class Jetpack_Photon { * @return string|bool */ public function filter_image_downsize( $image, $attachment_id, $size ) { - // Don't foul up the admin side of things, and provide plugins a way of preventing Photon from being applied to images. - if ( - is_admin() || + // Don't foul up the admin side of things, unless a plugin wants to. + if ( is_admin() && /** - * Provide plugins a way of preventing Photon from being applied to images retrieved from WordPress Core. + * Provide plugins a way of running Photon for images in the WordPress Dashboard (wp-admin). + * + * Note: enabling this will result in Photon URLs added to your post content, which could make migrations across domains (and off Photon) a bit more challenging. * * @module photon * - * @since 2.0.0 + * @since 4.8.0 * - * @param bool false Stop Photon from being applied to the image. Default to false. + * @param bool false Stop Photon from being run on the Dashboard. Default to false. * @param array $args { * Array of image details. * @@ -422,9 +423,30 @@ class Jetpack_Photon { * @type $size Image size. Can be a string (name of the image size, e.g. full) or an integer. * } */ - apply_filters( 'jetpack_photon_override_image_downsize', false, compact( 'image', 'attachment_id', 'size' ) ) - ) + false === apply_filters( 'jetpack_photon_admin_allow_image_downsize', false, compact( 'image', 'attachment_id', 'size' ) ) + ) { + return $image; + } + + /** + * Provide plugins a way of preventing Photon from being applied to images retrieved from WordPress Core. + * + * @module photon + * + * @since 2.0.0 + * + * @param bool false Stop Photon from being applied to the image. Default to false. + * @param array $args { + * Array of image details. + * + * @type $image Image URL. + * @type $attachment_id Attachment ID of the image. + * @type $size Image size. Can be a string (name of the image size, e.g. full) or an integer. + * } + */ + if ( apply_filters( 'jetpack_photon_override_image_downsize', false, compact( 'image', 'attachment_id', 'size' ) ) ) { return $image; + } // Get the image URL and proceed with Photon-ification if successful $image_url = wp_get_attachment_url( $attachment_id ); |