Completed
Push — branch-7.4 ( b2383c...18ea03 )
by Jeremy
29:31 queued 22:53
created

module-extras.php ➔ jetpack_priv_notice_privacy_selector()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 18
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 18
loc 18
rs 9.6666
c 0
b 0
f 0
1
<?php
2
/**
3
 * Load module code that is needed even when a module isn't active.
4
 * For example, if a module shouldn't be activatable unless certain conditions are met,
5
 * the code belongs in this file.
6
 *
7
 * @package Jetpack
8
 */
9
10
/**
11
 * Features available all the time:
12
 *    - When in development mode.
13
 *    - When connected to WordPress.com.
14
 */
15
$tools = array(
16
	// Always loaded, but only registered if theme supports it.
17
	'custom-post-types/comics.php',
18
	'custom-post-types/testimonial.php',
19
	'custom-post-types/nova.php',
20
	'geo-location.php',
21
	'theme-tools.php',
22
	'theme-tools/social-links.php',
23
	'theme-tools/random-redirect.php',
24
	'theme-tools/featured-content.php',
25
	'theme-tools/infinite-scroll.php',
26
	'theme-tools/responsive-videos.php',
27
	'theme-tools/site-logo.php',
28
	'theme-tools/site-breadcrumbs.php',
29
	'theme-tools/social-menu.php',
30
	'theme-tools/content-options.php',
31
	// Needed for SEO Tools.
32
	'seo-tools/jetpack-seo-utils.php',
33
	'seo-tools/jetpack-seo-titles.php',
34
	'seo-tools/jetpack-seo-posts.php',
35
	'verification-tools/verification-tools-utils.php',
36
	// Needed for VideoPress, so videos keep working in existing posts/pages when the module is deactivated.
37
	'videopress/utility-functions.php',
38
	'videopress/class.videopress-gutenberg.php',
39
);
40
41
// Some features are only available when connected to WordPress.com.
42
$connected_tools = array(
43
	'calypsoify/class.jetpack-calypsoify.php',
44
	'plugin-search.php',
45
	'simple-payments/simple-payments.php',
46
	'woocommerce-analytics/wp-woocommerce-analytics.php',
47
	'wpcom-block-editor/class-jetpack-wpcom-block-editor.php',
48
);
49
50
// Add connected features to our existing list if the site is currently connected.
51
if ( Jetpack::is_active() ) {
52
	$tools = array_merge( $tools, $connected_tools );
53
}
54
55
/**
56
 * Filter extra tools (not modules) to include.
57
 *
58
 * @since 2.4.0
59
 * @since 5.4.0 can be used in multisite when Jetpack is not connected to WordPress.com and not in development mode.
60
 *
61
 * @param array $tools Array of extra tools to include.
62
 */
63
$jetpack_tools_to_include = apply_filters( 'jetpack_tools_to_include', $tools );
64
65
if ( ! empty( $jetpack_tools_to_include ) ) {
66
	foreach ( $jetpack_tools_to_include as $tool ) {
67
		if ( file_exists( JETPACK__PLUGIN_DIR . '/modules/' . $tool ) ) {
68
			require_once JETPACK__PLUGIN_DIR . '/modules/' . $tool;
69
		}
70
	}
71
}
72
73
/**
74
 * Add the "(Jetpack)" suffix to the widget names
75
 *
76
 * @param string $widget_name Widget name.
77
 */
78
function jetpack_widgets_add_suffix( $widget_name ) {
79
	return sprintf(
80
		/* Translators: Placeholder is the name of a widget. */
81
		__( '%s (Jetpack)', 'jetpack' ),
82
		$widget_name
83
	);
84
}
85
add_filter( 'jetpack_widget_name', 'jetpack_widgets_add_suffix' );
86