module-extras.php
| 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, the code belongs in this file. |
| 5 | */ |
| 6 | |
| 7 | // Include extra tools that aren't modules, in a filterable way |
| 8 | $tools = array( |
| 9 | 'theme-tools/social-links.php', |
| 10 | 'theme-tools/random-redirect.php', |
| 11 | 'theme-tools/featured-content.php', |
| 12 | 'theme-tools/infinite-scroll.php', |
| 13 | 'theme-tools/responsive-videos.php', |
| 14 | 'theme-tools/site-logo.php', |
| 15 | 'theme-tools/site-breadcrumbs.php', |
| 16 | 'theme-tools/social-menu.php', |
| 17 | 'theme-tools/content-options.php', |
| 18 | 'custom-post-types/comics.php', |
| 19 | 'custom-post-types/testimonial.php', |
| 20 | 'custom-post-types/nova.php', |
| 21 | 'theme-tools.php', |
| 22 | 'seo-tools/jetpack-seo-utils.php', |
| 23 | 'seo-tools/jetpack-seo-titles.php', |
| 24 | 'seo-tools/jetpack-seo-posts.php', |
| 25 | 'simple-payments/simple-payments.php', |
| 26 | 'verification-tools/verification-tools-utils.php', |
| 27 | 'woocommerce-analytics/wp-woocommerce-analytics.php', |
| 28 | 'geo-location.php', |
| 29 | 'calypsoify/class.jetpack-calypsoify.php', |
| 30 | |
| 31 | // Keep working the VideoPress videos in existing posts/pages when the module is deactivated |
| 32 | 'videopress/utility-functions.php', |
| 33 | 'videopress/class.videopress-gutenberg.php', |
| 34 | |
| 35 | 'plugin-search.php', |
| 36 | ); |
| 37 | |
| 38 | // Not every tool needs to be included if Jetpack is inactive and not in development mode |
| 39 | if ( ! Jetpack::is_active() && ! Jetpack::is_development_mode() ) { |
| 40 | $tools = array( |
| 41 | 'seo-tools/jetpack-seo-utils.php', |
| 42 | 'seo-tools/jetpack-seo-titles.php', |
| 43 | 'seo-tools/jetpack-seo-posts.php', |
| 44 | ); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Filter extra tools (not modules) to include. |
| 49 | * |
| 50 | * @since 2.4.0 |
| 51 | * @since 5.4.0 can be used in multisite when Jetpack is not connected to WordPress.com and not in development mode. |
| 52 | * |
| 53 | * @param array $tools Array of extra tools to include. |
| 54 | */ |
| 55 | $jetpack_tools_to_include = apply_filters( 'jetpack_tools_to_include', $tools ); |
| 56 | |
| 57 | if ( ! empty( $jetpack_tools_to_include ) ) { |
| 58 | foreach ( $jetpack_tools_to_include as $tool ) { |
| 59 | if ( file_exists( JETPACK__PLUGIN_DIR . '/modules/' . $tool ) ) { |
| 60 | require_once( JETPACK__PLUGIN_DIR . '/modules/' . $tool ); |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Add the "(Jetpack)" suffix to the widget names |
| 67 | */ |
| 68 | function jetpack_widgets_add_suffix( $widget_name ) { |
| 69 | return sprintf( __( '%s (Jetpack)', 'jetpack' ), $widget_name ); |
| 70 | } |
| 71 | add_filter( 'jetpack_widget_name', 'jetpack_widgets_add_suffix' ); |
| 72 |