PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
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 13.7.2 All 507 releases
jetpack / jetpack_vendor / automattic / jetpack-image-cdn / src / compatibility / breakdance.php

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

47 lines 1.1 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 if ( ! defined( 'ABSPATH' ) ) {
15 exit( 0 );
16 }
17
18 /**
19 * Hook the compatibility functions into Breakdance filters.
20 *
21 * @since 0.7.20
22 *
23 * @return void
24 */
25 function load_breakdance_compat() {
26 add_filter( 'breakdance_singular_content', __NAMESPACE__ . '\use_image_cdn' );
27 }
28 add_action( 'plugins_loaded', __NAMESPACE__ . '\load_breakdance_compat' );
29
30 /**
31 * Unless the 'Apply the_content filter to Breakdance content' option is enabled
32 * in the Breakdance settings, the content will not be filtered by the_content filter.
33 * This ensures that images are passed through Image CDN when it's enabled.
34 *
35 * @since 0.7.20
36 *
37 * @param string $content The content to filter.
38 * @return string The filtered content.
39 */
40 function use_image_cdn( $content ) {
41 if ( Image_CDN::is_enabled() ) {
42 $content = Image_CDN::filter_the_content( $content );
43 }
44
45 return $content;
46 }
47