Skip to content

Commit 0bad9cf

Browse files
committed
Remove code from the global scope
1 parent f1b0f40 commit 0bad9cf

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

3rd-party/3rd-party.php

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,35 @@
66
* @package Jetpack
77
*/
88

9-
// Array of third-party compat files to always require.
10-
$compat_files = array(
11-
'bbpress.php',
12-
'beaverbuilder.php',
13-
'bitly.php',
14-
'buddypress.php',
15-
'class.jetpack-amp-support.php',
16-
'class.jetpack-modules-overrides.php', // Special case. Tools to be used to override module settings.
17-
'debug-bar.php',
18-
'domain-mapping.php',
19-
'polldaddy.php',
20-
'qtranslate-x.php',
21-
'vaultpress.php',
22-
'wpml.php',
23-
'woocommerce.php',
24-
'woocommerce-services.php',
25-
);
9+
namespace Automattic\Jetpack;
2610

27-
foreach ( $compat_files as $file ) {
28-
if ( file_exists( JETPACK__PLUGIN_DIR . '/3rd-party/' . $file ) ) {
29-
require_once JETPACK__PLUGIN_DIR . '/3rd-party/' . $file;
11+
/**
12+
* Loads the individual 3rd-party compat files.
13+
*/
14+
function load_3rd_party() {
15+
// Array of third-party compat files to always require.
16+
$compat_files = array(
17+
'bbpress.php',
18+
'beaverbuilder.php',
19+
'bitly.php',
20+
'buddypress.php',
21+
'class.jetpack-amp-support.php',
22+
'class.jetpack-modules-overrides.php', // Special case. Tools to be used to override module settings.
23+
'debug-bar.php',
24+
'domain-mapping.php',
25+
'polldaddy.php',
26+
'qtranslate-x.php',
27+
'vaultpress.php',
28+
'wpml.php',
29+
'woocommerce.php',
30+
'woocommerce-services.php',
31+
);
32+
33+
foreach ( $compat_files as $file ) {
34+
if ( file_exists( JETPACK__PLUGIN_DIR . '/3rd-party/' . $file ) ) {
35+
require_once JETPACK__PLUGIN_DIR . '/3rd-party/' . $file;
36+
}
3037
}
3138
}
39+
40+
load_3rd_party();

0 commit comments

Comments
 (0)