| @@ -1,13 +1,22 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Compatibility functions for bbpress. |
| 4 | 4 | * |
| 5 | + * Only added if bbpress is active via function_exists( 'bbpress' ) in 3rd-party.php. | |
| 6 | + * | |
| 5 | 7 | * @package automattic/jetpack |
| 6 | 8 | */ |
| 7 | 9 | |
| 8 | -add_action( 'init', 'jetpack_bbpress_compat', 11 ); // Priority 11 needed to ensure sharing_display is loaded. | |
| 10 | +use Automattic\Jetpack\Image_CDN\Image_CDN; | |
| 9 | 11 | |
| 12 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 13 | + exit( 0 ); | |
| 14 | +} | |
| 15 | + | |
| 16 | +// Priority 11 needed to ensure sharing_display is loaded. | |
| 17 | +add_action( 'init', 'jetpack_bbpress_compat', 11 ); | |
| 18 | + | |
| 10 | 19 | /** |
| 11 | 20 | * Adds Jetpack + bbPress Compatibility filters. |
| 12 | 21 | * |
| 13 | 22 | * @author Brandon Kraft |
| @@ -13,12 +22,8 @@ | ||
| 13 | 22 | * @author Brandon Kraft |
| 14 | 23 | * @since 3.7.1 |
| 15 | 24 | */ |
| 16 | 25 | function jetpack_bbpress_compat() { |
| 17 | - if ( ! function_exists( 'bbpress' ) ) { | |
| 18 | - return; | |
| 19 | - } | |
| 20 | - | |
| 21 | 26 | /** |
| 22 | 27 | * Add compatibility layer for REST API. |
| 23 | 28 | * |
| 24 | 29 | * @since 8.5.0 Moved from root-level file and check_rest_api_compat() |
| @@ -49,11 +54,11 @@ | ||
| 49 | 54 | * Use Photon for all images in Topics and replies. |
| 50 | 55 | * |
| 51 | 56 | * @since 4.9.0 |
| 52 | 57 | */ |
| 53 | - if ( class_exists( 'Jetpack_Photon' ) && Jetpack::is_module_active( 'photon' ) ) { | |
| 54 | - add_filter( 'bbp_get_topic_content', array( 'Jetpack_Photon', 'filter_the_content' ), 999999 ); | |
| 55 | - add_filter( 'bbp_get_reply_content', array( 'Jetpack_Photon', 'filter_the_content' ), 999999 ); | |
| 58 | + if ( class_exists( Image_CDN::class ) && Image_CDN::is_enabled() ) { | |
| 59 | + add_filter( 'bbp_get_topic_content', array( Image_CDN::class, 'filter_the_content' ), 999999 ); | |
| 60 | + add_filter( 'bbp_get_reply_content', array( Image_CDN::class, 'filter_the_content' ), 999999 ); | |
| 56 | 61 | } |
| 57 | 62 | } |
| 58 | 63 | |
| 59 | 64 | /** |