| @@ -1,0 +1,104 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Load all Jetpack files that do not get loaded via the autoloader. | |
| 4 | + * | |
| 5 | + * @package automattic/jetpack | |
| 6 | + */ | |
| 7 | + | |
| 8 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 9 | + exit( 0 ); | |
| 10 | +} | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * Checks if the code debug mode turned on, and returns false if it is. When Jetpack is in | |
| 14 | + * code debug mode, it shouldn't use minified assets. Note that this filter is not being used | |
| 15 | + * in every place where assets are enqueued. The filter is added at priority 9 to be overridden | |
| 16 | + * by any default priority filter that runs after it. | |
| 17 | + * | |
| 18 | + * @since 6.2.0 | |
| 19 | + * | |
| 20 | + * @return boolean | |
| 21 | + * | |
| 22 | + * @filter jetpack_should_use_minified_assets | |
| 23 | + */ | |
| 24 | +function jetpack_should_use_minified_assets() { | |
| 25 | + return ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG; | |
| 26 | +} | |
| 27 | +add_filter( 'jetpack_should_use_minified_assets', 'jetpack_should_use_minified_assets', 9 ); | |
| 28 | + | |
| 29 | +// @todo: Abstract out the admin functions, and only include them if is_admin() | |
| 30 | +require_once JETPACK__PLUGIN_DIR . 'class.jetpack.php'; | |
| 31 | +require_once JETPACK__PLUGIN_DIR . 'class.jetpack-network.php'; | |
| 32 | +require_once JETPACK__PLUGIN_DIR . 'class.jetpack-client-server.php'; | |
| 33 | +require_once JETPACK__PLUGIN_DIR . 'class.jetpack-user-agent.php'; | |
| 34 | +require_once JETPACK__PLUGIN_DIR . 'class.jetpack-post-images.php'; | |
| 35 | +require_once JETPACK__PLUGIN_DIR . 'class.jetpack-heartbeat.php'; | |
| 36 | +require_once JETPACK__PLUGIN_DIR . 'class.photon.php'; | |
| 37 | +require_once JETPACK__PLUGIN_DIR . 'functions.photon.php'; | |
| 38 | +require_once JETPACK__PLUGIN_DIR . 'functions.global.php'; | |
| 39 | +require_once JETPACK__PLUGIN_DIR . 'functions.compat.php'; | |
| 40 | +require_once JETPACK__PLUGIN_DIR . 'class-jetpack-gallery-settings.php'; | |
| 41 | +require_once JETPACK__PLUGIN_DIR . 'functions.cookies.php'; | |
| 42 | +require_once JETPACK__PLUGIN_DIR . 'class.jetpack-autoupdate.php'; | |
| 43 | +require_once JETPACK__PLUGIN_DIR . 'class.frame-nonce-preview.php'; | |
| 44 | +require_once JETPACK__PLUGIN_DIR . 'modules/module-headings.php'; | |
| 45 | +require_once JETPACK__PLUGIN_DIR . 'class.jetpack-plan.php'; | |
| 46 | +// Used by the API endpoints or used in an odd number of places. | |
| 47 | +require_once JETPACK__PLUGIN_DIR . 'modules/seo-tools/class-jetpack-seo-utils.php'; | |
| 48 | +require_once JETPACK__PLUGIN_DIR . 'modules/seo-tools/class-jetpack-seo-titles.php'; | |
| 49 | +require_once JETPACK__PLUGIN_DIR . 'modules/seo-tools/class-jetpack-seo-posts.php'; | |
| 50 | +require_once JETPACK__PLUGIN_DIR . 'modules/verification-tools/verification-tools-utils.php'; | |
| 51 | +require_once JETPACK__PLUGIN_DIR . 'modules/shortcodes/shortcode-utils.php'; // Shortcodes are often referenced in other modules, so making it available early. | |
| 52 | + | |
| 53 | +require_once JETPACK__PLUGIN_DIR . 'class-jetpack-xmlrpc-methods.php'; | |
| 54 | +Jetpack_XMLRPC_Methods::init(); | |
| 55 | + | |
| 56 | +require_once JETPACK__PLUGIN_DIR . 'class-jetpack-connection-status.php'; | |
| 57 | +Jetpack_Connection_Status::init(); | |
| 58 | + | |
| 59 | +require_once JETPACK__PLUGIN_DIR . '_inc/lib/class-jetpack-application-password-extras.php'; | |
| 60 | +Jetpack_Application_Password_Extras::init(); | |
| 61 | + | |
| 62 | +// Also required directly by the AI extension files because on WordPress.com | |
| 63 | +// Simple this bootstrap never runs. The class self-initializes when loaded. | |
| 64 | +require_once JETPACK__PLUGIN_DIR . '_inc/lib/class-jetpack-ai-settings.php'; | |
| 65 | +require_once JETPACK__PLUGIN_DIR . '_inc/lib/class-jetpack-ai-feature-flags.php'; | |
| 66 | +require_once JETPACK__PLUGIN_DIR . '_inc/lib/class-jetpack-settings-feature-flags.php'; | |
| 67 | + | |
| 68 | +\Automattic\Jetpack\Newsletter\Settings::register_feature_flags(); | |
| 69 | + | |
| 70 | +if ( is_admin() ) { | |
| 71 | + require_once JETPACK__PLUGIN_DIR . 'class.jetpack-admin.php'; | |
| 72 | + require_once JETPACK__PLUGIN_DIR . '_inc/lib/debugger.php'; | |
| 73 | + | |
| 74 | + // Initialize Newsletter Settings (always-loaded so the settings page URL works even when module is inactive). | |
| 75 | + \Automattic\Jetpack\Newsletter\Settings::init(); | |
| 76 | + | |
| 77 | + \Automattic\Jetpack\Newsletter\Writing_Prompt_Widget::init(); | |
| 78 | + | |
| 79 | + // Settings > Sharing owns its own screen, so it exists whichever modules are active. | |
| 80 | + \Automattic\Jetpack\Sharing_Likes\Settings\Settings_Page::init(); | |
| 81 | + \Automattic\Jetpack\Sharing_Likes\Settings\Post_Handler::init(); | |
| 82 | + | |
| 83 | + \Automattic\Jetpack\Plugin\Jetpack_Script_Data::configure(); | |
| 84 | +} | |
| 85 | + | |
| 86 | +// Play nice with https://wp-cli.org/. | |
| 87 | +if ( defined( 'WP_CLI' ) && WP_CLI ) { | |
| 88 | + require_once JETPACK__PLUGIN_DIR . 'class.jetpack-cli.php'; | |
| 89 | +} | |
| 90 | + | |
| 91 | +require_once JETPACK__PLUGIN_DIR . '_inc/lib/class.core-rest-api-endpoints.php'; | |
| 92 | +require_once JETPACK__PLUGIN_DIR . '_inc/blogging-prompts.php'; | |
| 93 | +if ( is_admin() ) { | |
| 94 | + require_once JETPACK__PLUGIN_DIR . '_inc/content-guidelines-ai.php'; | |
| 95 | +} | |
| 96 | + | |
| 97 | +add_action( 'updating_jetpack_version', array( 'Jetpack', 'activate_subscriptions_module_for_existing_sites' ), 10, 2 ); | |
| 98 | +add_action( 'updating_jetpack_version', array( 'Jetpack', 'cleanup_seo_module_state_options' ) ); | |
| 99 | +add_action( 'updating_jetpack_version', array( 'Jetpack', 'seed_seo_visibility_cohort' ), 10, 2 ); | |
| 100 | +add_filter( 'is_jetpack_site', '__return_true' ); | |
| 101 | + | |
| 102 | +require_once JETPACK__PLUGIN_DIR . '3rd-party/3rd-party.php'; | |
| 103 | + | |
| 104 | +Jetpack::init(); | |