|
|
|
@ -13,7 +13,8 @@ use Automattic\Jetpack\Admin_UI\Admin_Menu;
|
|
|
|
|
use Automattic\Jetpack\Assets;
|
|
|
|
|
use Automattic\Jetpack\Connection\Initial_State as Connection_Initial_State;
|
|
|
|
|
use Automattic\Jetpack\Connection\Manager as Connection_Manager;
|
|
|
|
|
use Automattic\Jetpack\JITMS\JITM as JITM;
|
|
|
|
|
use Automattic\Jetpack\IP\Utils as IP_Utils;
|
|
|
|
|
use Automattic\Jetpack\JITMS\JITM;
|
|
|
|
|
use Automattic\Jetpack\Modules;
|
|
|
|
|
use Automattic\Jetpack\My_Jetpack\Initializer as My_Jetpack_Initializer;
|
|
|
|
|
use Automattic\Jetpack\My_Jetpack\Products as My_Jetpack_Products;
|
|
|
|
@ -151,8 +152,7 @@ class Jetpack_Protect {
|
|
|
|
|
$menu_label,
|
|
|
|
|
'manage_options',
|
|
|
|
|
'jetpack-protect',
|
|
|
|
|
array( $this, 'plugin_settings_page' ),
|
|
|
|
|
99
|
|
|
|
|
array( $this, 'plugin_settings_page' )
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
add_action( 'load-' . $page_suffix, array( $this, 'enqueue_admin_scripts' ) );
|
|
|
|
@ -183,7 +183,7 @@ class Jetpack_Protect {
|
|
|
|
|
// Required for Analytics.
|
|
|
|
|
wp_enqueue_script( 'jp-tracks', '//stats.wp.com/w.js', array(), gmdate( 'YW' ), true );
|
|
|
|
|
// Initial JS state including JP Connection data.
|
|
|
|
|
wp_add_inline_script( 'jetpack-protect', Connection_Initial_State::render(), 'before' );
|
|
|
|
|
Connection_Initial_State::render_script( 'jetpack-protect' );
|
|
|
|
|
wp_add_inline_script( 'jetpack-protect', $this->render_initial_state(), 'before' );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -218,7 +218,8 @@ class Jetpack_Protect {
|
|
|
|
|
'jetpackScan' => My_Jetpack_Products::get_product( 'scan' ),
|
|
|
|
|
'hasRequiredPlan' => Plan::has_required_plan(),
|
|
|
|
|
'waf' => array(
|
|
|
|
|
'isSupported' => Waf_Runner::is_supported_environment(),
|
|
|
|
|
'wafSupported' => Waf_Runner::is_supported_environment(),
|
|
|
|
|
'currentIp' => IP_Utils::get_ip(),
|
|
|
|
|
'isSeen' => self::get_waf_seen_status(),
|
|
|
|
|
'upgradeIsSeen' => self::get_waf_upgrade_seen_status(),
|
|
|
|
|
'displayUpgradeBadge' => self::get_waf_upgrade_badge_display_status(),
|
|
|
|
@ -331,11 +332,11 @@ class Jetpack_Protect {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check for user licenses.
|
|
|
|
|
* Check if the user has an available license that includes Jetpack Scan.
|
|
|
|
|
*
|
|
|
|
|
* @param boolean $has_license Check if user has a license.
|
|
|
|
|
* @param object $licenses List of licenses.
|
|
|
|
|
* @param string $plugin_slug The plugin that initiated the flow.
|
|
|
|
|
* @param boolean $has_license Whether a license was already found.
|
|
|
|
|
* @param object[] $licenses Unattached licenses belonging to the user.
|
|
|
|
|
* @param string $plugin_slug Slug of the plugin that initiated the flow.
|
|
|
|
|
*
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
@ -347,6 +348,10 @@ class Jetpack_Protect {
|
|
|
|
|
$license_found = false;
|
|
|
|
|
|
|
|
|
|
foreach ( $licenses as $license ) {
|
|
|
|
|
if ( $license->attached_at || $license->revoked_at ) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( in_array( $license->product_id, self::JETPACK_SCAN_PRODUCT_IDS, true ) ) {
|
|
|
|
|
$license_found = true;
|
|
|
|
|
break;
|
|
|
|
@ -448,5 +453,4 @@ class Jetpack_Protect {
|
|
|
|
|
'automaticRulesLastUpdated' => Waf_Stats::get_automatic_rules_last_updated(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|