Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 34 |
|
0.00% |
0 / 1 |
CRAP | n/a |
0 / 0 |
|
| Automattic\Jetpack\load_3rd_party_compat_filters | |
0.00% |
0 / 31 |
|
0.00% |
0 / 1 |
240 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Compatibility files for third-party plugins. |
| 4 | * This is used to improve compatibility of specific Jetpack features with third-party plugins. |
| 5 | * |
| 6 | * @package automattic/jetpack |
| 7 | */ |
| 8 | |
| 9 | namespace Automattic\Jetpack; |
| 10 | |
| 11 | use Automattic\Jetpack\Status\Host; |
| 12 | |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit( 0 ); |
| 15 | } |
| 16 | |
| 17 | add_action( 'plugins_loaded', __NAMESPACE__ . '\load_3rd_party_compat_filters', 11 ); |
| 18 | /** |
| 19 | * Loads the individual 3rd-party compat functions. |
| 20 | * |
| 21 | * This is a refactor of load_3rd_party() to load the individual compat files only when needed instead of universally. |
| 22 | */ |
| 23 | function load_3rd_party_compat_filters() { |
| 24 | |
| 25 | // bbPress |
| 26 | if ( function_exists( 'bbpress' ) ) { |
| 27 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/bbpress.php'; |
| 28 | } |
| 29 | |
| 30 | // Beaver Builder |
| 31 | if ( class_exists( 'FLBuilder' ) ) { |
| 32 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/beaverbuilder.php'; |
| 33 | } |
| 34 | |
| 35 | // Bitly |
| 36 | if ( class_exists( 'Bitly' ) ) { |
| 37 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/bitly.php'; |
| 38 | } |
| 39 | |
| 40 | // BuddyPress |
| 41 | if ( class_exists( 'BuddyPress' ) ) { |
| 42 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/buddypress.php'; |
| 43 | } |
| 44 | |
| 45 | // AMP. AMP__DIR__ is defined in the AMP plugin since the very first version. |
| 46 | if ( Constants::is_defined( 'AMP__DIR__' ) ) { |
| 47 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/amp.php'; |
| 48 | } |
| 49 | |
| 50 | // Domain Mapping. All assume multisite, so it's an easy check. |
| 51 | if ( Constants::is_defined( 'SUNRISE' ) ) { |
| 52 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/class-domain-mapping.php'; |
| 53 | } |
| 54 | |
| 55 | // Debug Bar |
| 56 | if ( class_exists( 'Debug_Bar' ) ) { |
| 57 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/debug-bar.php'; |
| 58 | } |
| 59 | |
| 60 | // Letting these always load since it handles somethings upon plugin activation. |
| 61 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/creative-mail.php'; |
| 62 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/jetpack-backup.php'; |
| 63 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/jetpack-boost.php'; |
| 64 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/woocommerce-services.php'; |
| 65 | |
| 66 | // qTranslate. Plugin closed in 2021, but leaving support for now to allow sites to drop it. |
| 67 | if ( Constants::is_defined( 'QTX_VERSION' ) ) { |
| 68 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/qtranslate-x.php'; |
| 69 | } |
| 70 | |
| 71 | // VaultPress. |
| 72 | if ( Constants::is_defined( 'VAULTPRESS__VERSION' ) || class_exists( 'VaultPress' ) ) { |
| 73 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/vaultpress.php'; |
| 74 | } |
| 75 | |
| 76 | // Web Stories |
| 77 | if ( Constants::is_defined( 'WEBSTORIES_VERSION' ) ) { |
| 78 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/web-stories.php'; |
| 79 | } |
| 80 | |
| 81 | // WooCommerce |
| 82 | if ( class_exists( 'WooCommerce' ) ) { |
| 83 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/woocommerce.php'; |
| 84 | } |
| 85 | |
| 86 | // Atomic Weekly |
| 87 | if ( ( new Host() )->is_atomic_platform() ) { |
| 88 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/atomic.php'; |
| 89 | } |
| 90 | |
| 91 | // WordPress.com Reader |
| 92 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/wpcom-reader.php'; |
| 93 | |
| 94 | // WPML |
| 95 | if ( defined( 'ICL_SITEPRESS_VERSION' ) ) { |
| 96 | require_once JETPACK__PLUGIN_DIR . '/3rd-party/wpml.php'; |
| 97 | } |
| 98 | } |