PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3
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
← All changes | 3rd-party/bbpress.php +74 -0 16.2-beta → 16.3 View file →
@@ -1,0 +1,74 @@
1 +<?php
2 +/**
3 + * Compatibility functions for bbpress.
4 + *
5 + * Only added if bbpress is active via function_exists( 'bbpress' ) in 3rd-party.php.
6 + *
7 + * @package automattic/jetpack
8 + */
9 +
10 +use Automattic\Jetpack\Image_CDN\Image_CDN;
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 +
19 +/**
20 + * Adds Jetpack + bbPress Compatibility filters.
21 + *
22 + * @author Brandon Kraft
23 + * @since 3.7.1
24 + */
25 +function jetpack_bbpress_compat() {
26 + /**
27 + * Add compatibility layer for REST API.
28 + *
29 + * @since 8.5.0 Moved from root-level file and check_rest_api_compat()
30 + */
31 + require_once __DIR__ . '/class-jetpack-bbpress-rest-api.php';
32 + Jetpack_BbPress_REST_API::instance();
33 +
34 + // Adds sharing buttons to bbPress items.
35 + if ( function_exists( 'sharing_display' ) ) {
36 + add_filter( 'bbp_get_topic_content', 'sharing_display', 19 );
37 + add_action( 'bbp_template_after_single_forum', 'jetpack_sharing_bbpress' );
38 + add_action( 'bbp_template_after_single_topic', 'jetpack_sharing_bbpress' );
39 + }
40 +
41 + /**
42 + * Enable Markdown support for bbpress post types.
43 + *
44 + * @author Brandon Kraft
45 + * @since 6.0.0
46 + */
47 + if ( function_exists( 'bbp_get_topic_post_type' ) ) {
48 + add_post_type_support( bbp_get_topic_post_type(), 'wpcom-markdown' );
49 + add_post_type_support( bbp_get_reply_post_type(), 'wpcom-markdown' );
50 + add_post_type_support( bbp_get_forum_post_type(), 'wpcom-markdown' );
51 + }
52 +
53 + /**
54 + * Use Photon for all images in Topics and replies.
55 + *
56 + * @since 4.9.0
57 + */
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 );
61 + }
62 +}
63 +
64 +/**
65 + * Display Jetpack "Sharing" buttons on bbPress 2.x forums/ topics/ lead topics/ replies.
66 + *
67 + * Determination if the sharing buttons should display on the post type is handled within sharing_display().
68 + *
69 + * @author David Decker
70 + * @since 3.7.0
71 + */
72 +function jetpack_sharing_bbpress() {
73 + sharing_display( null, true );
74 +}