| @@ -3,37 +3,45 @@ | ||
| 3 | 3 | * Plugin Name: Jetpack |
| 4 | 4 | * Plugin URI: https://jetpack.com |
| 5 | 5 | * Description: Security, performance, and marketing tools made by WordPress experts. Jetpack keeps your site protected so you can focus on more important things. |
| 6 | 6 | * Author: Automattic |
| 7 | - * Version: 12.0.3 | |
| 7 | + * Version: 16.2 | |
| 8 | 8 | * Author URI: https://jetpack.com |
| 9 | 9 | * License: GPL2+ |
| 10 | 10 | * Text Domain: jetpack |
| 11 | - * Requires at least: 6.0 | |
| 12 | - * Requires PHP: 5.6 | |
| 11 | + * Requires at least: 7.0 | |
| 12 | + * Requires PHP: 7.4 | |
| 13 | 13 | * |
| 14 | 14 | * @package automattic/jetpack |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | /* |
| 18 | -This program is free software; you can redistribute it and/or | |
| 19 | -modify it under the terms of the GNU General Public License | |
| 20 | -as published by the Free Software Foundation; either version 2 | |
| 21 | -of the License, or (at your option) any later version. | |
| 18 | + * This program is free software; you can redistribute it and/or | |
| 19 | + * modify it under the terms of the GNU General Public License | |
| 20 | + * as published by the Free Software Foundation; either version 2 | |
| 21 | + * of the License, or (at your option) any later version. | |
| 22 | + * | |
| 23 | + * This program is distributed in the hope that it will be useful, | |
| 24 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 25 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 26 | + * GNU General Public License for more details. | |
| 27 | + * | |
| 28 | + * You should have received a copy of the GNU General Public License | |
| 29 | + * along with this program; if not, see <https://www.gnu.org/licenses/>. | |
| 30 | + */ | |
| 22 | 31 | |
| 23 | -This program is distributed in the hope that it will be useful, | |
| 24 | -but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 25 | -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 26 | -GNU General Public License for more details. | |
| 32 | +use Automattic\Jetpack\Image_CDN\Image_CDN_Core; | |
| 27 | 33 | |
| 28 | -You should have received a copy of the GNU General Public License | |
| 29 | -along with this program; if not, write to the Free Software | |
| 30 | -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| 31 | -*/ | |
| 34 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 35 | + exit( 0 ); | |
| 36 | +} | |
| 32 | 37 | |
| 33 | -define( 'JETPACK__MINIMUM_WP_VERSION', '6.0' ); | |
| 34 | -define( 'JETPACK__MINIMUM_PHP_VERSION', '5.6' ); | |
| 35 | -define( 'JETPACK__VERSION', '12.0.3' ); | |
| 38 | +if ( ! defined( 'JETPACK__VERSION' ) ) { | |
| 39 | + // This breaks the project version checks when a one-liner. | |
| 40 | + define( 'JETPACK__VERSION', '16.2' ); | |
| 41 | +} | |
| 42 | +defined( 'JETPACK__MINIMUM_WP_VERSION' ) || define( 'JETPACK__MINIMUM_WP_VERSION', '7.0' ); | |
| 43 | +defined( 'JETPACK__MINIMUM_PHP_VERSION' ) || define( 'JETPACK__MINIMUM_PHP_VERSION', '7.4' ); | |
| 36 | 44 | |
| 37 | 45 | /** |
| 38 | 46 | * Constant used to fetch the connection owner token |
| 39 | 47 | * |
| @@ -39,15 +47,14 @@ | ||
| 39 | 47 | * |
| 40 | 48 | * @deprecated 9.0.0 |
| 41 | 49 | * @var boolean |
| 42 | 50 | */ |
| 43 | -define( 'JETPACK_MASTER_USER', true ); | |
| 51 | +defined( 'JETPACK_MASTER_USER' ) || define( 'JETPACK_MASTER_USER', true ); | |
| 44 | 52 | |
| 45 | -define( 'JETPACK__API_VERSION', 1 ); | |
| 46 | -define( 'JETPACK__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); | |
| 47 | -define( 'JETPACK__PLUGIN_FILE', __FILE__ ); | |
| 53 | +defined( 'JETPACK__API_VERSION' ) || define( 'JETPACK__API_VERSION', 1 ); | |
| 54 | +defined( 'JETPACK__PLUGIN_DIR' ) || define( 'JETPACK__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); | |
| 55 | +defined( 'JETPACK__PLUGIN_FILE' ) || define( 'JETPACK__PLUGIN_FILE', __FILE__ ); | |
| 48 | 56 | |
| 49 | -defined( 'JETPACK__RELEASE_POST_BLOG_SLUG' ) || define( 'JETPACK__RELEASE_POST_BLOG_SLUG', 'jetpackreleaseblog.wordpress.com' ); | |
| 50 | 57 | defined( 'JETPACK_CLIENT__AUTH_LOCATION' ) || define( 'JETPACK_CLIENT__AUTH_LOCATION', 'header' ); |
| 51 | 58 | |
| 52 | 59 | /** |
| 53 | 60 | * WP.com API no longer supports `http://` protocol. |
| @@ -112,9 +119,10 @@ | ||
| 112 | 119 | * Outputs for an admin notice about running Jetpack on outdated WordPress. |
| 113 | 120 | * |
| 114 | 121 | * @since 7.2.0 |
| 115 | 122 | */ |
| 116 | - function jetpack_admin_unsupported_wp_notice() { ?> | |
| 123 | + function jetpack_admin_unsupported_wp_notice() { | |
| 124 | + ?> | |
| 117 | 125 | <div class="notice notice-error is-dismissible"> |
| 118 | 126 | <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> |
| 119 | 127 | </div> |
| 120 | 128 | <?php |
| @@ -152,8 +160,22 @@ | ||
| 152 | 160 | ) |
| 153 | 161 | ); |
| 154 | 162 | } |
| 155 | 163 | |
| 164 | + // Add a red bubble notification to My Jetpack if the installation is bad. | |
| 165 | + add_filter( | |
| 166 | + 'my_jetpack_red_bubble_notification_slugs', | |
| 167 | + function ( $slugs ) { | |
| 168 | + $slugs['jetpack-plugin-bad-installation'] = array( | |
| 169 | + 'data' => array( | |
| 170 | + 'plugin' => 'Jetpack', | |
| 171 | + ), | |
| 172 | + ); | |
| 173 | + | |
| 174 | + return $slugs; | |
| 175 | + } | |
| 176 | + ); | |
| 177 | + | |
| 156 | 178 | /** |
| 157 | 179 | * Outputs an admin notice for folks running Jetpack without having run composer install. |
| 158 | 180 | * |
| 159 | 181 | * @since 7.4.0 |
| @@ -158,30 +180,33 @@ | ||
| 158 | 180 | * |
| 159 | 181 | * @since 7.4.0 |
| 160 | 182 | */ |
| 161 | 183 | function jetpack_admin_missing_files() { |
| 162 | - ?> | |
| 163 | - <div class="notice notice-error is-dismissible"> | |
| 164 | - <p> | |
| 165 | - <?php | |
| 166 | - printf( | |
| 167 | - wp_kses( | |
| 168 | - /* translators: Placeholder is a link to a support document. */ | |
| 169 | - __( '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.', 'jetpack' ), | |
| 170 | - array( | |
| 171 | - 'a' => array( | |
| 172 | - 'href' => array(), | |
| 173 | - 'target' => array(), | |
| 174 | - 'rel' => array(), | |
| 175 | - ), | |
| 176 | - ) | |
| 184 | + if ( get_current_screen()->id !== 'plugins' ) { | |
| 185 | + return; | |
| 186 | + } | |
| 187 | + $message = sprintf( | |
| 188 | + wp_kses( | |
| 189 | + /* translators: Placeholder is a link to a support document. */ | |
| 190 | + __( '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 | + array( | |
| 192 | + 'a' => array( | |
| 193 | + 'href' => array(), | |
| 194 | + 'rel' => array(), | |
| 195 | + 'target' => array(), | |
| 177 | 196 | ), |
| 178 | - 'https://github.com/Automattic/jetpack/blob/trunk/docs/development-environment.md#building-your-project' | |
| 179 | - ); | |
| 180 | - ?> | |
| 181 | - </p> | |
| 182 | - </div> | |
| 183 | - <?php | |
| 197 | + 'code' => array(), | |
| 198 | + ) | |
| 199 | + ), | |
| 200 | + 'https://github.com/Automattic/jetpack/blob/trunk/docs/development-environment.md#building-your-project' | |
| 201 | + ); | |
| 202 | + wp_admin_notice( | |
| 203 | + $message, | |
| 204 | + array( | |
| 205 | + 'type' => 'error', | |
| 206 | + 'dismissible' => true, | |
| 207 | + ) | |
| 208 | + ); | |
| 184 | 209 | } |
| 185 | 210 | |
| 186 | 211 | add_action( 'admin_notices', 'jetpack_admin_missing_files' ); |
| 187 | 212 | return; |
| @@ -188,7 +213,10 @@ | ||
| 188 | 213 | } |
| 189 | 214 | |
| 190 | 215 | register_activation_hook( __FILE__, array( 'Jetpack', 'plugin_activation' ) ); |
| 191 | 216 | register_deactivation_hook( __FILE__, array( 'Jetpack', 'plugin_deactivation' ) ); |
| 217 | + | |
| 218 | +// Load image cdn core. This should load regardless of whether the photon module is active. | |
| 219 | +Image_CDN_Core::setup(); | |
| 192 | 220 | |
| 193 | 221 | // Require everything else, that is not loaded via the autoloader. |
| 194 | 222 | require_once JETPACK__PLUGIN_DIR . 'load-jetpack.php'; |