Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack
File: jetpack.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Plugin Name: Jetpack
[2] Fix | Delete
* Plugin URI: https://jetpack.com
[3] Fix | Delete
* Description: Security, performance, and marketing tools made by WordPress experts. Jetpack keeps your site protected so you can focus on more important things.
[4] Fix | Delete
* Author: Automattic
[5] Fix | Delete
* Version: 15.0
[6] Fix | Delete
* Author URI: https://jetpack.com
[7] Fix | Delete
* License: GPL2+
[8] Fix | Delete
* Text Domain: jetpack
[9] Fix | Delete
* Requires at least: 6.7
[10] Fix | Delete
* Requires PHP: 7.2
[11] Fix | Delete
*
[12] Fix | Delete
* @package automattic/jetpack
[13] Fix | Delete
*/
[14] Fix | Delete
[15] Fix | Delete
/*
[16] Fix | Delete
* This program is free software; you can redistribute it and/or
[17] Fix | Delete
* modify it under the terms of the GNU General Public License
[18] Fix | Delete
* as published by the Free Software Foundation; either version 2
[19] Fix | Delete
* of the License, or (at your option) any later version.
[20] Fix | Delete
*
[21] Fix | Delete
* This program is distributed in the hope that it will be useful,
[22] Fix | Delete
* but WITHOUT ANY WARRANTY; without even the implied warranty of
[23] Fix | Delete
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[24] Fix | Delete
* GNU General Public License for more details.
[25] Fix | Delete
*
[26] Fix | Delete
* You should have received a copy of the GNU General Public License
[27] Fix | Delete
* along with this program; if not, write to the Free Software
[28] Fix | Delete
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
[29] Fix | Delete
*/
[30] Fix | Delete
[31] Fix | Delete
use Automattic\Jetpack\Image_CDN\Image_CDN_Core;
[32] Fix | Delete
[33] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[34] Fix | Delete
exit( 0 );
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
if ( ! defined( 'JETPACK__VERSION' ) ) {
[38] Fix | Delete
// This breaks the project version checks when a one-liner.
[39] Fix | Delete
define( 'JETPACK__VERSION', '15.0' );
[40] Fix | Delete
}
[41] Fix | Delete
defined( 'JETPACK__MINIMUM_WP_VERSION' ) || define( 'JETPACK__MINIMUM_WP_VERSION', '6.7' );
[42] Fix | Delete
defined( 'JETPACK__MINIMUM_PHP_VERSION' ) || define( 'JETPACK__MINIMUM_PHP_VERSION', '7.2' );
[43] Fix | Delete
[44] Fix | Delete
/**
[45] Fix | Delete
* Constant used to fetch the connection owner token
[46] Fix | Delete
*
[47] Fix | Delete
* @deprecated 9.0.0
[48] Fix | Delete
* @var boolean
[49] Fix | Delete
*/
[50] Fix | Delete
defined( 'JETPACK_MASTER_USER' ) || define( 'JETPACK_MASTER_USER', true );
[51] Fix | Delete
[52] Fix | Delete
defined( 'JETPACK__API_VERSION' ) || define( 'JETPACK__API_VERSION', 1 );
[53] Fix | Delete
defined( 'JETPACK__PLUGIN_DIR' ) || define( 'JETPACK__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
[54] Fix | Delete
defined( 'JETPACK__PLUGIN_FILE' ) || define( 'JETPACK__PLUGIN_FILE', __FILE__ );
[55] Fix | Delete
[56] Fix | Delete
defined( 'JETPACK__RELEASE_POST_BLOG_SLUG' ) || define( 'JETPACK__RELEASE_POST_BLOG_SLUG', 'jetpackreleaseblog.wordpress.com' );
[57] Fix | Delete
defined( 'JETPACK_CLIENT__AUTH_LOCATION' ) || define( 'JETPACK_CLIENT__AUTH_LOCATION', 'header' );
[58] Fix | Delete
[59] Fix | Delete
/**
[60] Fix | Delete
* WP.com API no longer supports `http://` protocol.
[61] Fix | Delete
* This means Jetpack can't function properly on servers that can't send outbound HTTPS requests.
[62] Fix | Delete
* The constant is no longer used.
[63] Fix | Delete
*
[64] Fix | Delete
* @deprecated 9.1.0
[65] Fix | Delete
*/
[66] Fix | Delete
defined( 'JETPACK_CLIENT__HTTPS' ) || define( 'JETPACK_CLIENT__HTTPS', 'AUTO' );
[67] Fix | Delete
[68] Fix | Delete
defined( 'JETPACK__GLOTPRESS_LOCALES_PATH' ) || define( 'JETPACK__GLOTPRESS_LOCALES_PATH', JETPACK__PLUGIN_DIR . 'jetpack_vendor/automattic/jetpack-compat/lib/locales.php' );
[69] Fix | Delete
defined( 'JETPACK__API_BASE' ) || define( 'JETPACK__API_BASE', 'https://jetpack.wordpress.com/jetpack.' );
[70] Fix | Delete
defined( 'JETPACK_PROTECT__API_HOST' ) || define( 'JETPACK_PROTECT__API_HOST', 'https://api.bruteprotect.com/' );
[71] Fix | Delete
defined( 'JETPACK__WPCOM_JSON_API_BASE' ) || define( 'JETPACK__WPCOM_JSON_API_BASE', 'https://public-api.wordpress.com' );
[72] Fix | Delete
[73] Fix | Delete
/**
[74] Fix | Delete
* WP.com API no longer supports `http://` protocol.
[75] Fix | Delete
* Use `JETPACK__WPCOM_JSON_API_BASE` instead, which has the protocol hardcoded.
[76] Fix | Delete
*
[77] Fix | Delete
* @deprecated 9.1.0
[78] Fix | Delete
*/
[79] Fix | Delete
defined( 'JETPACK__WPCOM_JSON_API_HOST' ) || define( 'JETPACK__WPCOM_JSON_API_HOST', 'public-api.wordpress.com' );
[80] Fix | Delete
[81] Fix | Delete
defined( 'JETPACK__SANDBOX_DOMAIN' ) || define( 'JETPACK__SANDBOX_DOMAIN', '' );
[82] Fix | Delete
defined( 'JETPACK__DEBUGGER_PUBLIC_KEY' ) || define(
[83] Fix | Delete
'JETPACK__DEBUGGER_PUBLIC_KEY',
[84] Fix | Delete
"\r\n" . '-----BEGIN PUBLIC KEY-----' . "\r\n"
[85] Fix | Delete
. 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm+uLLVoxGCY71LS6KFc6' . "\r\n"
[86] Fix | Delete
. '1UnF6QGBAsi5XF8ty9kR3/voqfOkpW+gRerM2Kyjy6DPCOmzhZj7BFGtxSV2ZoMX' . "\r\n"
[87] Fix | Delete
. '9ZwWxzXhl/Q/6k8jg8BoY1QL6L2K76icXJu80b+RDIqvOfJruaAeBg1Q9NyeYqLY' . "\r\n"
[88] Fix | Delete
. 'lEVzN2vIwcFYl+MrP/g6Bc2co7Jcbli+tpNIxg4Z+Hnhbs7OJ3STQLmEryLpAxQO' . "\r\n"
[89] Fix | Delete
. 'q8cbhQkMx+FyQhxzSwtXYI/ClCUmTnzcKk7SgGvEjoKGAmngILiVuEJ4bm7Q1yok' . "\r\n"
[90] Fix | Delete
. 'xl9+wcfW6JAituNhml9dlHCWnn9D3+j8pxStHihKy2gVMwiFRjLEeD8K/7JVGkb/' . "\r\n"
[91] Fix | Delete
. 'EwIDAQAB' . "\r\n"
[92] Fix | Delete
. '-----END PUBLIC KEY-----' . "\r\n"
[93] Fix | Delete
);
[94] Fix | Delete
[95] Fix | Delete
/*
[96] Fix | Delete
* These constants can be set in wp-config.php to ensure sites behind proxies will still work.
[97] Fix | Delete
* Setting these constants, though, is *not* the preferred method. It's better to configure
[98] Fix | Delete
* the proxy to send the X-Forwarded-Port header.
[99] Fix | Delete
*/
[100] Fix | Delete
defined( 'JETPACK_SIGNATURE__HTTP_PORT' ) || define( 'JETPACK_SIGNATURE__HTTP_PORT', 80 );
[101] Fix | Delete
defined( 'JETPACK_SIGNATURE__HTTPS_PORT' ) || define( 'JETPACK_SIGNATURE__HTTPS_PORT', 443 );
[102] Fix | Delete
[103] Fix | Delete
/**
[104] Fix | Delete
* Check if the version of WordPress in use on the site is supported by Jetpack.
[105] Fix | Delete
*/
[106] Fix | Delete
if ( version_compare( $GLOBALS['wp_version'], JETPACK__MINIMUM_WP_VERSION, '<' ) ) {
[107] Fix | Delete
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
[108] Fix | Delete
error_log( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
[109] Fix | Delete
sprintf(
[110] Fix | Delete
/* translators: Placeholders are numbers, versions of WordPress in use on the site, and required by WordPress. */
[111] Fix | Delete
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' ),
[112] Fix | Delete
$GLOBALS['wp_version'],
[113] Fix | Delete
JETPACK__MINIMUM_WP_VERSION
[114] Fix | Delete
)
[115] Fix | Delete
);
[116] Fix | Delete
}
[117] Fix | Delete
[118] Fix | Delete
/**
[119] Fix | Delete
* Outputs for an admin notice about running Jetpack on outdated WordPress.
[120] Fix | Delete
*
[121] Fix | Delete
* @since 7.2.0
[122] Fix | Delete
*/
[123] Fix | Delete
function jetpack_admin_unsupported_wp_notice() {
[124] Fix | Delete
?>
[125] Fix | Delete
<div class="notice notice-error is-dismissible">
[126] Fix | Delete
<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>
[127] Fix | Delete
</div>
[128] Fix | Delete
<?php
[129] Fix | Delete
}
[130] Fix | Delete
[131] Fix | Delete
add_action( 'admin_notices', 'jetpack_admin_unsupported_wp_notice' );
[132] Fix | Delete
return;
[133] Fix | Delete
}
[134] Fix | Delete
[135] Fix | Delete
/**
[136] Fix | Delete
* This is where the loading of Jetpack begins.
[137] Fix | Delete
*
[138] Fix | Delete
* First, we try to load our composer autoloader.
[139] Fix | Delete
*
[140] Fix | Delete
* - If it fails, we "pause" Jetpack by ending the loading process
[141] Fix | Delete
* and displaying an admin_notice to inform the site owner.
[142] Fix | Delete
* (We want to fail gracefully if `composer install` has not been executed yet, so we are checking for the autoloader.)
[143] Fix | Delete
* - If it succeeds, we require load-jetpack.php, where all legacy files are required,
[144] Fix | Delete
* and where we add on to various hooks that we expect to always run.
[145] Fix | Delete
*/
[146] Fix | Delete
$jetpack_autoloader = JETPACK__PLUGIN_DIR . 'vendor/autoload_packages.php';
[147] Fix | Delete
$jetpack_module_headings_file = JETPACK__PLUGIN_DIR . 'modules/module-headings.php'; // This file is loaded later in load-jetpack.php, but let's check here to pause before half-loading Jetpack.
[148] Fix | Delete
if ( is_readable( $jetpack_autoloader ) && is_readable( $jetpack_module_headings_file ) ) {
[149] Fix | Delete
require_once $jetpack_autoloader;
[150] Fix | Delete
if ( method_exists( '\Automattic\Jetpack\Assets', 'alias_textdomains_from_file' ) ) {
[151] Fix | Delete
\Automattic\Jetpack\Assets::alias_textdomains_from_file( JETPACK__PLUGIN_DIR . 'jetpack_vendor/i18n-map.php' );
[152] Fix | Delete
}
[153] Fix | Delete
} else {
[154] Fix | Delete
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
[155] Fix | Delete
error_log( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
[156] Fix | Delete
sprintf(
[157] Fix | Delete
/* translators: Placeholder is a link to a support document. */
[158] Fix | Delete
__( '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' ),
[159] Fix | Delete
'https://github.com/Automattic/jetpack/blob/trunk/docs/development-environment.md'
[160] Fix | Delete
)
[161] Fix | Delete
);
[162] Fix | Delete
}
[163] Fix | Delete
[164] Fix | Delete
// Add a red bubble notification to My Jetpack if the installation is bad.
[165] Fix | Delete
add_filter(
[166] Fix | Delete
'my_jetpack_red_bubble_notification_slugs',
[167] Fix | Delete
function ( $slugs ) {
[168] Fix | Delete
$slugs['jetpack-plugin-bad-installation'] = array(
[169] Fix | Delete
'data' => array(
[170] Fix | Delete
'plugin' => 'Jetpack',
[171] Fix | Delete
),
[172] Fix | Delete
);
[173] Fix | Delete
[174] Fix | Delete
return $slugs;
[175] Fix | Delete
}
[176] Fix | Delete
);
[177] Fix | Delete
[178] Fix | Delete
/**
[179] Fix | Delete
* Outputs an admin notice for folks running Jetpack without having run composer install.
[180] Fix | Delete
*
[181] Fix | Delete
* @since 7.4.0
[182] Fix | Delete
*/
[183] Fix | Delete
function jetpack_admin_missing_files() {
[184] Fix | Delete
if ( get_current_screen()->id !== 'plugins' ) {
[185] Fix | Delete
return;
[186] Fix | Delete
}
[187] Fix | Delete
$message = sprintf(
[188] Fix | Delete
wp_kses(
[189] Fix | Delete
/* translators: Placeholder is a link to a support document. */
[190] Fix | Delete
__( '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 must have Composer dependencies installed and built via the build command: <code>jetpack build plugins/jetpack --deps</code>', 'jetpack' ),
[191] Fix | Delete
array(
[192] Fix | Delete
'a' => array(
[193] Fix | Delete
'href' => array(),
[194] Fix | Delete
'rel' => array(),
[195] Fix | Delete
'target' => array(),
[196] Fix | Delete
),
[197] Fix | Delete
'code' => array(),
[198] Fix | Delete
)
[199] Fix | Delete
),
[200] Fix | Delete
'https://github.com/Automattic/jetpack/blob/trunk/docs/development-environment.md#building-your-project'
[201] Fix | Delete
);
[202] Fix | Delete
wp_admin_notice(
[203] Fix | Delete
$message,
[204] Fix | Delete
array(
[205] Fix | Delete
'type' => 'error',
[206] Fix | Delete
'dismissible' => true,
[207] Fix | Delete
)
[208] Fix | Delete
);
[209] Fix | Delete
}
[210] Fix | Delete
[211] Fix | Delete
add_action( 'admin_notices', 'jetpack_admin_missing_files' );
[212] Fix | Delete
return;
[213] Fix | Delete
}
[214] Fix | Delete
[215] Fix | Delete
register_activation_hook( __FILE__, array( 'Jetpack', 'plugin_activation' ) );
[216] Fix | Delete
register_deactivation_hook( __FILE__, array( 'Jetpack', 'plugin_deactivation' ) );
[217] Fix | Delete
[218] Fix | Delete
// Load image cdn core. This should load regardless of whether the photon module is active.
[219] Fix | Delete
Image_CDN_Core::setup();
[220] Fix | Delete
[221] Fix | Delete
// Require everything else, that is not loaded via the autoloader.
[222] Fix | Delete
require_once JETPACK__PLUGIN_DIR . 'load-jetpack.php';
[223] Fix | Delete
[224] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function