updated plugin Jetpack Protect
version 1.4.2
This commit is contained in:
@ -5,6 +5,34 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.3.4] - 2023-08-23
|
||||
### Changed
|
||||
- Updated package dependencies. [#32605]
|
||||
|
||||
## [0.3.3] - 2023-06-19
|
||||
### Added
|
||||
- Add the Advanced SEO feature to the list of free features. [#31213]
|
||||
|
||||
## [0.3.2] - 2023-06-12
|
||||
### Changed
|
||||
- Remove Jetpack-the-plugin dependencies from Current Plan class. [#31207]
|
||||
|
||||
## [0.3.1] - 2023-06-05
|
||||
### Fixed
|
||||
- Revert gating removal for simple payments [#31067]
|
||||
|
||||
## [0.3.0] - 2023-05-11
|
||||
### Changed
|
||||
- Make Earn products free for all Jetpack plans [#30432]
|
||||
|
||||
## [0.2.12] - 2023-05-08
|
||||
### Changed
|
||||
- Make Premium Content accessible on Free plans. [#30398]
|
||||
|
||||
## [0.2.11] - 2023-04-10
|
||||
### Added
|
||||
- Add Jetpack Autoloader package suggestion. [#29988]
|
||||
|
||||
## [0.2.10] - 2023-02-20
|
||||
### Changed
|
||||
- Minor internal updates.
|
||||
@ -74,6 +102,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Deprecated
|
||||
- Moved the options class into Connection. [#24095]
|
||||
|
||||
[0.3.4]: https://github.com/Automattic/jetpack-plans/compare/v0.3.3...v0.3.4
|
||||
[0.3.3]: https://github.com/Automattic/jetpack-plans/compare/v0.3.2...v0.3.3
|
||||
[0.3.2]: https://github.com/Automattic/jetpack-plans/compare/v0.3.1...v0.3.2
|
||||
[0.3.1]: https://github.com/Automattic/jetpack-plans/compare/v0.3.0...v0.3.1
|
||||
[0.3.0]: https://github.com/Automattic/jetpack-plans/compare/v0.2.12...v0.3.0
|
||||
[0.2.12]: https://github.com/Automattic/jetpack-plans/compare/v0.2.11...v0.2.12
|
||||
[0.2.11]: https://github.com/Automattic/jetpack-plans/compare/v0.2.10...v0.2.11
|
||||
[0.2.10]: https://github.com/Automattic/jetpack-plans/compare/v0.2.9...v0.2.10
|
||||
[0.2.9]: https://github.com/Automattic/jetpack-plans/compare/v0.2.8...v0.2.9
|
||||
[0.2.8]: https://github.com/Automattic/jetpack-plans/compare/v0.2.7...v0.2.8
|
||||
|
@ -4,14 +4,17 @@
|
||||
"type": "library",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"require": {
|
||||
"automattic/jetpack-connection": "^1.51.0"
|
||||
"automattic/jetpack-connection": "^1.57.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"yoast/phpunit-polyfills": "1.0.4",
|
||||
"automattic/jetpack-changelogger": "^3.3.2",
|
||||
"automattic/jetpack-status": "^1.16.2",
|
||||
"yoast/phpunit-polyfills": "1.1.0",
|
||||
"automattic/jetpack-changelogger": "^3.3.8",
|
||||
"automattic/jetpack-status": "^1.18.1",
|
||||
"automattic/wordbless": "@dev"
|
||||
},
|
||||
"suggest": {
|
||||
"automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package."
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
@ -38,7 +41,7 @@
|
||||
"link-template": "https://github.com/Automattic/jetpack-plans/compare/v${old}...v${new}"
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-trunk": "0.2.x-dev"
|
||||
"dev-trunk": "0.3.x-dev"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
|
@ -2,15 +2,13 @@
|
||||
/**
|
||||
* Handles fetching of the site's plan and products from WordPress.com and caching values locally.
|
||||
*
|
||||
* This file was copied and adapted from the Jetpack plugin on Mar 2022
|
||||
*
|
||||
* @package automattic/jetpack
|
||||
* @package automattic/jetpack-plans
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack;
|
||||
|
||||
use Automattic\Jetpack\Connection\Client;
|
||||
use Jetpack_Options;
|
||||
use Automattic\Jetpack\Connection\Manager;
|
||||
|
||||
/**
|
||||
* Provides methods methods for fetching the site's plan and products from WordPress.com.
|
||||
@ -43,12 +41,15 @@ class Current_Plan {
|
||||
'jetpack_free',
|
||||
),
|
||||
'supports' => array(
|
||||
'advanced-seo',
|
||||
'opentable',
|
||||
'calendly',
|
||||
'send-a-message',
|
||||
'whatsapp-button',
|
||||
'social-previews',
|
||||
'videopress',
|
||||
'videopress/video',
|
||||
'v6-video-frame-poster',
|
||||
|
||||
'core/video',
|
||||
'core/cover',
|
||||
@ -62,13 +63,12 @@ class Current_Plan {
|
||||
'personal-bundle',
|
||||
'personal-bundle-monthly',
|
||||
'personal-bundle-2y',
|
||||
'personal-bundle-3y',
|
||||
'starter-plan',
|
||||
),
|
||||
'supports' => array(
|
||||
'akismet',
|
||||
'payments',
|
||||
'recurring-payments',
|
||||
'premium-content/container',
|
||||
'videopress',
|
||||
),
|
||||
),
|
||||
@ -79,9 +79,9 @@ class Current_Plan {
|
||||
'value_bundle',
|
||||
'value_bundle-monthly',
|
||||
'value_bundle-2y',
|
||||
'value_bundle-3y',
|
||||
),
|
||||
'supports' => array(
|
||||
'donations',
|
||||
'simple-payments',
|
||||
'vaultpress',
|
||||
'videopress',
|
||||
@ -108,9 +108,11 @@ class Current_Plan {
|
||||
'business-bundle',
|
||||
'business-bundle-monthly',
|
||||
'business-bundle-2y',
|
||||
'business-bundle-3y',
|
||||
'ecommerce-bundle',
|
||||
'ecommerce-bundle-monthly',
|
||||
'ecommerce-bundle-2y',
|
||||
'ecommerce-bundle-3y',
|
||||
'pro-plan',
|
||||
),
|
||||
'supports' => array(),
|
||||
@ -210,9 +212,18 @@ class Current_Plan {
|
||||
* @return bool True if plan is updated, false if no update
|
||||
*/
|
||||
public static function refresh_from_wpcom() {
|
||||
$site_id = Manager::get_site_id();
|
||||
if ( is_wp_error( $site_id ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make the API request.
|
||||
|
||||
$response = Client::wpcom_json_api_request_as_blog( sprintf( '/sites/%d', Jetpack_Options::get_option( 'id' ) ) . '?force=wpcom', '1.1' );
|
||||
$response = Client::wpcom_json_api_request_as_blog(
|
||||
sprintf( '/sites/%d?force=wpcom', $site_id ),
|
||||
'1.1'
|
||||
);
|
||||
|
||||
return self::update_from_sites_response( $response );
|
||||
}
|
||||
|
||||
@ -248,16 +259,14 @@ class Current_Plan {
|
||||
|
||||
list( $plan['class'], $supports ) = self::get_class_and_features( $plan['product_slug'] );
|
||||
|
||||
// get available features if Jetpack is active.
|
||||
if ( class_exists( 'Jetpack' ) ) {
|
||||
foreach ( \Jetpack::get_available_modules() as $module_slug ) {
|
||||
$module = \Jetpack::get_module( $module_slug );
|
||||
if ( ! isset( $module ) || ! is_array( $module ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( in_array( 'free', $module['plan_classes'], true ) || in_array( $plan['class'], $module['plan_classes'], true ) ) {
|
||||
$supports[] = $module_slug;
|
||||
}
|
||||
$modules = new Modules();
|
||||
foreach ( $modules->get_available() as $module_slug ) {
|
||||
$module = $modules->get( $module_slug );
|
||||
if ( ! isset( $module ) || ! is_array( $module ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( in_array( 'free', $module['plan_classes'], true ) || in_array( $plan['class'], $module['plan_classes'], true ) ) {
|
||||
$supports[] = $module_slug;
|
||||
}
|
||||
}
|
||||
|
||||
@ -318,7 +327,7 @@ class Current_Plan {
|
||||
/**
|
||||
* Determine whether the active plan supports a particular feature
|
||||
*
|
||||
* @uses Jetpack_Plan::get()
|
||||
* @uses self::get()
|
||||
*
|
||||
* @access public
|
||||
* @static
|
||||
@ -353,6 +362,11 @@ class Current_Plan {
|
||||
return true;
|
||||
}
|
||||
|
||||
// As of 05 2023 - all plans support Earn features (minus 'simple-payments')
|
||||
if ( in_array( $feature, array( 'donations', 'recurring-payments', 'premium-content/container' ), true ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$plan = self::get();
|
||||
|
||||
if (
|
||||
|
Reference in New Issue
Block a user