Skip to content

Commit

Permalink
3rd party tools: update the way the files are required (#12026)
Browse files Browse the repository at this point in the history
* 3rd party tools: update the way the files are required

This change:

- makes it easier to add new files to that list in the future.
- allows us to sync that file with WordPress.com. On WordPress.com, since some of the compat files do not exist, they just won't be required.
- orders the list alphabetically
- fixes all phpcs warnings

* Add 3rd party loading file to phpcs whitelist.
  • Loading branch information
jeherve authored Apr 15, 2019
1 parent 48d46f9 commit 08a66d7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
44 changes: 26 additions & 18 deletions 3rd-party/3rd-party.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
<?php

/**
* Placeholder to load 3rd party plugin tweaks until a legit system
* is architected
* Compatibility files for third-party plugins.
* This is used to improve compatibility of specific Jetpack features with third-party plugins.
*
* @package Jetpack
*/

require_once( JETPACK__PLUGIN_DIR . '3rd-party/buddypress.php' );
require_once( JETPACK__PLUGIN_DIR . '3rd-party/wpml.php' );
require_once( JETPACK__PLUGIN_DIR . '3rd-party/bitly.php' );
require_once( JETPACK__PLUGIN_DIR . '3rd-party/bbpress.php' );
require_once( JETPACK__PLUGIN_DIR . '3rd-party/woocommerce.php' );
require_once( JETPACK__PLUGIN_DIR . '3rd-party/domain-mapping.php' );
require_once( JETPACK__PLUGIN_DIR . '3rd-party/qtranslate-x.php' );
require_once( JETPACK__PLUGIN_DIR . '3rd-party/vaultpress.php' );
require_once( JETPACK__PLUGIN_DIR . '3rd-party/beaverbuilder.php' );
require_once( JETPACK__PLUGIN_DIR . '3rd-party/debug-bar.php' );
require_once( JETPACK__PLUGIN_DIR . '3rd-party/class.jetpack-modules-overrides.php' );
// Array of third-party compat files to always require.
$compat_files = array(
'bbpress.php',
'beaverbuilder.php',
'bitly.php',
'buddypress.php',
'class.jetpack-amp-support.php',
'class.jetpack-modules-overrides.php', // Special case. Tools to be used to override module settings.
'debug-bar.php',
'domain-mapping.php',
'polldaddy.php',
'qtranslate-x.php',
'vaultpress.php',
'wpml.php',
'woocommerce.php',
'woocommerce-services.php',
);

// We can't load this conditionally since polldaddy add the call in class constuctor.
require_once( JETPACK__PLUGIN_DIR . '3rd-party/polldaddy.php' );
require_once( JETPACK__PLUGIN_DIR . '3rd-party/woocommerce-services.php' );
require_once( JETPACK__PLUGIN_DIR . '3rd-party/class.jetpack-amp-support.php' );
foreach ( $compat_files as $file ) {
if ( file_exists( JETPACK__PLUGIN_DIR . '/3rd-party/' . $file ) ) {
require_once JETPACK__PLUGIN_DIR . '/3rd-party/' . $file;
}
}
1 change: 1 addition & 0 deletions bin/phpcs-whitelist.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// If the file path starts with anything like in the array below, it should be linted.
module.exports = [
'3rd-party/3rd-party.php',
'class.jetpack-gutenberg.php',
'class.jetpack-plan.php',
'extensions/',
Expand Down

0 comments on commit 08a66d7

Please sign in to comment.