summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2020-01-06 14:32:30 -0500
committerAnthony G. Basile <blueness@gentoo.org>2020-01-06 14:32:30 -0500
commit10ef81bf85ad0a4bad0d204838e14c99ca2526f7 (patch)
treeb4bb36a326d41de12d1a6181d2a2baf34696ac24 /plugins/jetpack/jetpack.php
parentUpdating script for Update (diff)
downloadblogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.tar.gz
blogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.tar.bz2
blogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.zip
Update jetpack 8.0
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'plugins/jetpack/jetpack.php')
-rw-r--r--plugins/jetpack/jetpack.php228
1 files changed, 105 insertions, 123 deletions
diff --git a/plugins/jetpack/jetpack.php b/plugins/jetpack/jetpack.php
index e1c2d45c..1a8273de 100644
--- a/plugins/jetpack/jetpack.php
+++ b/plugins/jetpack/jetpack.php
@@ -1,35 +1,34 @@
<?php
-
-/*
+/**
* Plugin Name: Jetpack by WordPress.com
* Plugin URI: https://jetpack.com
* Description: Bring the power of the WordPress.com cloud to your self-hosted WordPress. Jetpack enables you to connect your blog to a WordPress.com account to use the powerful features normally only available to WordPress.com users.
* Author: Automattic
- * Version: 7.3.1
+ * Version: 8.0
* Author URI: https://jetpack.com
* License: GPL2+
* Text Domain: jetpack
* Domain Path: /languages/
+ *
+ * @package Jetpack
*/
-define( 'JETPACK__MINIMUM_WP_VERSION', '5.0' );
-
-define( 'JETPACK__VERSION', '7.3.1' );
-define( 'JETPACK_MASTER_USER', true );
-define( 'JETPACK__API_VERSION', 1 );
-define( 'JETPACK__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
-define( 'JETPACK__PLUGIN_FILE', __FILE__ );
-
-defined( 'JETPACK_CLIENT__AUTH_LOCATION' ) or define( 'JETPACK_CLIENT__AUTH_LOCATION', 'header' );
-defined( 'JETPACK_CLIENT__HTTPS' ) or define( 'JETPACK_CLIENT__HTTPS', 'AUTO' );
-defined( 'JETPACK__GLOTPRESS_LOCALES_PATH' ) or define( 'JETPACK__GLOTPRESS_LOCALES_PATH', JETPACK__PLUGIN_DIR . 'locales.php' );
-defined( 'JETPACK__API_BASE' ) or define( 'JETPACK__API_BASE', 'https://jetpack.wordpress.com/jetpack.' );
-defined( 'JETPACK_PROTECT__API_HOST' ) or define( 'JETPACK_PROTECT__API_HOST', 'https://api.bruteprotect.com/' );
-defined( 'JETPACK__WPCOM_JSON_API_HOST' ) or define( 'JETPACK__WPCOM_JSON_API_HOST', 'public-api.wordpress.com' );
-
-defined( 'JETPACK__SANDBOX_DOMAIN' ) or define( 'JETPACK__SANDBOX_DOMAIN', '' );
-
-defined( 'JETPACK__DEBUGGER_PUBLIC_KEY' ) or define(
+define( 'JETPACK__MINIMUM_WP_VERSION', '5.2' );
+define( 'JETPACK__MINIMUM_PHP_VERSION', '5.6' );
+define( 'JETPACK__VERSION', '8.0' );
+define( 'JETPACK_MASTER_USER', true );
+define( 'JETPACK__API_VERSION', 1 );
+define( 'JETPACK__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
+define( 'JETPACK__PLUGIN_FILE', __FILE__ );
+
+defined( 'JETPACK_CLIENT__AUTH_LOCATION' ) || define( 'JETPACK_CLIENT__AUTH_LOCATION', 'header' );
+defined( 'JETPACK_CLIENT__HTTPS' ) || define( 'JETPACK_CLIENT__HTTPS', 'AUTO' );
+defined( 'JETPACK__GLOTPRESS_LOCALES_PATH' ) || define( 'JETPACK__GLOTPRESS_LOCALES_PATH', JETPACK__PLUGIN_DIR . 'locales.php' );
+defined( 'JETPACK__API_BASE' ) || define( 'JETPACK__API_BASE', 'https://jetpack.wordpress.com/jetpack.' );
+defined( 'JETPACK_PROTECT__API_HOST' ) || define( 'JETPACK_PROTECT__API_HOST', 'https://api.bruteprotect.com/' );
+defined( 'JETPACK__WPCOM_JSON_API_HOST' ) || define( 'JETPACK__WPCOM_JSON_API_HOST', 'public-api.wordpress.com' );
+defined( 'JETPACK__SANDBOX_DOMAIN' ) || define( 'JETPACK__SANDBOX_DOMAIN', '' );
+defined( 'JETPACK__DEBUGGER_PUBLIC_KEY' ) || define(
'JETPACK__DEBUGGER_PUBLIC_KEY',
"\r\n" . '-----BEGIN PUBLIC KEY-----' . "\r\n"
. 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm+uLLVoxGCY71LS6KFc6' . "\r\n"
@@ -42,123 +41,106 @@ defined( 'JETPACK__DEBUGGER_PUBLIC_KEY' ) or define(
. '-----END PUBLIC KEY-----' . "\r\n"
);
-/**
- * Returns the location of Jetpack's lib directory. This filter is applied
- * in require_lib().
- *
- * @since 4.0.2
- *
- * @return string Location of Jetpack library directory.
- *
- * @filter require_lib_dir
+/*
+ * These constants can be set in wp-config.php to ensure sites behind proxies will still work.
+ * Setting these constants, though, is *not* the preferred method. It's better to configure
+ * the proxy to send the X-Forwarded-Port header.
*/
-function jetpack_require_lib_dir() {
- return JETPACK__PLUGIN_DIR . '_inc/lib';
-}
-
+defined( 'JETPACK_SIGNATURE__HTTP_PORT' ) || define( 'JETPACK_SIGNATURE__HTTP_PORT', 80 );
+defined( 'JETPACK_SIGNATURE__HTTPS_PORT' ) || define( 'JETPACK_SIGNATURE__HTTPS_PORT', 443 );
/**
- * Checks if the code debug mode turned on, and returns false if it is. When Jetpack is in
- * code debug mode, it shouldn't use minified assets. Note that this filter is not being used
- * in every place where assets are enqueued. The filter is added at priority 9 to be overridden
- * by any default priority filter that runs after it.
- *
- * @since 6.2.0
- *
- * @return boolean
- *
- * @filter jetpack_should_use_minified_assets
+ * Check if the version of WordPress in use on the site is supported by Jetpack.
*/
-function jetpack_should_use_minified_assets() {
- if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
- return false;
+if ( version_compare( $GLOBALS['wp_version'], JETPACK__MINIMUM_WP_VERSION, '<' ) ) {
+ if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
+ error_log( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
+ sprintf(
+ /* translators: Placeholders are numbers, versions of WordPress in use on the site, and required by WordPress. */
+ esc_html__( 'Your version of WordPress (%1$s) is lower than the version required by Jetpack (%2$s). Please update WordPress to continue enjoying Jetpack.', 'jetpack' ),
+ $GLOBALS['wp_version'],
+ JETPACK__MINIMUM_WP_VERSION
+ )
+ );
}
- return true;
-}
-/**
- * Outputs for an admin notice about running Jetpack on outdated WordPress.
- *
- * @since 7.2.0
- */
-function jetpack_admin_unsupported_wp_notice() { ?>
- <div class="notice notice-error is-dismissible">
- <p><?php esc_html_e( 'Jetpack requires a more recent version of WordPress and has been paused. Please update WordPress to continue enjoying Jetpack.', 'jetpack' ); ?></p>
- </div>
- <?php
-}
+ /**
+ * Outputs for an admin notice about running Jetpack on outdated WordPress.
+ *
+ * @since 7.2.0
+ */
+ function jetpack_admin_unsupported_wp_notice() { ?>
+ <div class="notice notice-error is-dismissible">
+ <p><?php esc_html_e( 'Jetpack requires a more recent version of WordPress and has been paused. Please update WordPress to continue enjoying Jetpack.', 'jetpack' ); ?></p>
+ </div>
+ <?php
+ }
-if ( version_compare( $GLOBALS['wp_version'], JETPACK__MINIMUM_WP_VERSION, '<' ) ) {
add_action( 'admin_notices', 'jetpack_admin_unsupported_wp_notice' );
return;
}
-add_filter( 'jetpack_require_lib_dir', 'jetpack_require_lib_dir' );
-add_filter( 'jetpack_should_use_minified_assets', 'jetpack_should_use_minified_assets', 9 );
-
-// @todo: Abstract out the admin functions, and only include them if is_admin()
-require_once( JETPACK__PLUGIN_DIR . 'class.jetpack.php' );
-require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-network.php' );
-require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-client.php' );
-require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-data.php' );
-require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-client-server.php' );
-require_once( JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-actions.php' );
-require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-options.php' );
-require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-user-agent.php' );
-require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-post-images.php' );
-require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-error.php' );
-require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-heartbeat.php' );
-require_once( JETPACK__PLUGIN_DIR . 'class.photon.php' );
-require_once( JETPACK__PLUGIN_DIR . 'functions.photon.php' );
-require_once( JETPACK__PLUGIN_DIR . 'functions.global.php' );
-require_once( JETPACK__PLUGIN_DIR . 'functions.compat.php' );
-require_once( JETPACK__PLUGIN_DIR . 'functions.gallery.php' );
-require_once( JETPACK__PLUGIN_DIR . 'require-lib.php' );
-require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-autoupdate.php' );
-require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-tracks.php' );
-require_once( JETPACK__PLUGIN_DIR . 'class.frame-nonce-preview.php' );
-require_once( JETPACK__PLUGIN_DIR . 'modules/module-headings.php');
-require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-constants.php');
-require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-idc.php' );
-require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-connection-banner.php' );
-require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-plan.php' );
-
-if ( is_admin() ) {
- require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-admin.php' );
- require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-jitm.php' );
- require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-affiliate.php' );
- jetpack_require_lib( 'debugger' );
-}
-
-// Play nice with http://wp-cli.org/
-if ( defined( 'WP_CLI' ) && WP_CLI ) {
- require_once( JETPACK__PLUGIN_DIR . 'class.jetpack-cli.php' );
-}
-
-require_once( JETPACK__PLUGIN_DIR . '_inc/lib/class.core-rest-api-endpoints.php' );
-
-register_activation_hook( __FILE__, array( 'Jetpack', 'plugin_activation' ) );
-register_deactivation_hook( __FILE__, array( 'Jetpack', 'plugin_deactivation' ) );
-add_action( 'updating_jetpack_version', array( 'Jetpack', 'do_version_bump' ), 10, 2 );
-add_action( 'init', array( 'Jetpack', 'init' ) );
-add_action( 'plugins_loaded', array( 'Jetpack', 'plugin_textdomain' ), 99 );
-add_action( 'plugins_loaded', array( 'Jetpack', 'load_modules' ), 100 );
-add_filter( 'jetpack_static_url', array( 'Jetpack', 'staticize_subdomain' ) );
-add_filter( 'is_jetpack_site', '__return_true' );
-
/**
- * Add an easy way to photon-ize a URL that is safe to call even if Jetpack isn't active.
+ * This is where the loading of Jetpack begins.
*
- * See: http://jetpack.com/2013/07/11/photon-and-themes/
+ * First, we try to load our composer autoloader.
+ *
+ * - If it fails, we "pause" Jetpack by ending the loading process
+ * and displaying an admin_notice to inform the site owner.
+ * (We want to fail gracefully if `composer install` has not been executed yet, so we are checking for the autoloader.)
+ * - If it succeeds, we require load-jetpack.php, where all legacy files are required,
+ * and where we add on to various hooks that we expect to always run.
*/
-if ( Jetpack::is_module_active( 'photon' ) ) {
- add_filter( 'jetpack_photon_url', 'jetpack_photon_url', 10, 3 );
-}
+$jetpack_autoloader = JETPACK__PLUGIN_DIR . 'vendor/autoload_packages.php';
+if ( is_readable( $jetpack_autoloader ) ) {
+ require $jetpack_autoloader;
+} else {
+ if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
+ error_log( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
+ sprintf(
+ /* translators: Placeholder is a link to a support document. */
+ __( 'Your installation of Jetpack is incomplete. If you installed Jetpack from GitHub, please refer to this document to set up your development environment: %1$s', 'jetpack' ),
+ 'https://github.com/Automattic/jetpack/blob/master/docs/development-environment.md'
+ )
+ );
+ }
-if ( JETPACK__SANDBOX_DOMAIN ) {
- require_once( JETPACK__PLUGIN_DIR . '_inc/jetpack-server-sandbox.php' );
+ /**
+ * Outputs an admin notice for folks running Jetpack without having run composer install.
+ *
+ * @since 7.4.0
+ */
+ function jetpack_admin_missing_autoloader() {
+ ?>
+ <div class="notice notice-error is-dismissible">
+ <p>
+ <?php
+ printf(
+ wp_kses(
+ /* translators: Placeholder is a link to a support document. */
+ __( 'Your installation of Jetpack is incomplete. If you installed Jetpack from GitHub, please refer to <a href="%1$s" target="_blank" rel="noopener noreferrer">this document</a> to set up your development environment.', 'jetpack' ),
+ array(
+ 'a' => array(
+ 'href' => array(),
+ 'target' => array(),
+ 'rel' => array(),
+ ),
+ )
+ ),
+ 'https://github.com/Automattic/jetpack/blob/master/docs/development-environment.md'
+ );
+ ?>
+ </p>
+ </div>
+ <?php
+ }
+
+ add_action( 'admin_notices', 'jetpack_admin_missing_autoloader' );
+ return;
}
-require_once( JETPACK__PLUGIN_DIR . '3rd-party/3rd-party.php' );
+register_activation_hook( __FILE__, array( 'Jetpack', 'plugin_activation' ) );
+register_deactivation_hook( __FILE__, array( 'Jetpack', 'plugin_deactivation' ) );
-Jetpack::init();
+// Require everything else, that is not loaded via the autoloader.
+require_once JETPACK__PLUGIN_DIR . 'load-jetpack.php';