PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.7
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.7
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 All 508 releases
jetpack / jetpack_vendor / automattic / jetpack-image-cdn / src / compatibility / breakdance.php

breakdance.php in Jetpack – WP Security, Backup, Speed, & Growth 16.3-a.7, at jetpack_vendor/automattic/jetpack-image-cdn/src/compatibility/breakdance.php

43 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Compatibility functions for the Breakdance plugin.
4 *
5 * @since 0.7.20
6 *
7 * @package automattic/jetpack-image-cdn
8 */
9
10 namespace Automattic\Jetpack\Image_CDN\Compatibility;
11
12 use Automattic\Jetpack\Image_CDN\Image_CDN;
13
14 /**
15 * Hook the compatibility functions into Breakdance filters.
16 *
17 * @since 0.7.20
18 *
19 * @return void
20 */
21 function load_breakdance_compat() {
22 add_filter( 'breakdance_singular_content', __NAMESPACE__ . '\use_image_cdn' );
23 }
24 add_action( 'plugins_loaded', __NAMESPACE__ . '\load_breakdance_compat' );
25
26 /**
27 * Unless the 'Apply the_content filter to Breakdance content' option is enabled
28 * in the Breakdance settings, the content will not be filtered by the_content filter.
29 * This ensures that images are passed through Image CDN when it's enabled.
30 *
31 * @since 0.7.20
32 *
33 * @param string $content The content to filter.
34 * @return string The filtered content.
35 */
36 function use_image_cdn( $content ) {
37 if ( Image_CDN::is_enabled() ) {
38 $content = Image_CDN::filter_the_content( $content );
39 }
40
41 return $content;
42 }
43