You appear to be a bot. Output may be restricted
Description
Checks the site plan and deactivates modules that were active but are no longer included in the plan.
Usage
$array = Jetpack_Admin_Page::check_plan_deactivate_modules( $page );
Parameters
- $page
- ( mixed ) required –
Returns
array
Source
File name: jetpack/_inc/lib/admin-pages/class.jetpack-admin-page.php
Lines:
1 to 54 of 54
function check_plan_deactivate_modules( $page ) { if ( ( new Status() )->is_offline_mode() || ! in_array( $page->base, array( 'toplevel_page_jetpack', 'admin_page_jetpack_modules', 'jetpack_page_vaultpress', 'jetpack_page_stats', 'jetpack_page_akismet-key-config', ) ) ) { return false; } $current = Jetpack_Plan::get(); $to_deactivate = array(); if ( isset( $current['product_slug'] ) ) { $active = Jetpack::get_active_modules(); switch ( $current['product_slug'] ) { case 'jetpack_free': $to_deactivate = array( 'seo-tools', 'videopress', 'google-analytics', 'wordads', 'search' ); break; case 'jetpack_personal': case 'jetpack_personal_monthly': $to_deactivate = array( 'seo-tools', 'videopress', 'google-analytics', 'wordads', 'search' ); break; case 'jetpack_premium': case 'jetpack_premium_monthly': $to_deactivate = array( 'seo-tools', 'google-analytics', 'search' ); break; } $to_deactivate = array_intersect( $active, $to_deactivate ); $to_leave_enabled = array(); foreach ( $to_deactivate as $feature ) { if ( Jetpack_Plan::supports( $feature ) ) { $to_leave_enabled [] = $feature; } } $to_deactivate = array_diff( $to_deactivate, $to_leave_enabled ); if ( ! empty( $to_deactivate ) ) { Jetpack::update_active_modules( array_filter( array_diff( $active, $to_deactivate ) ) ); } } return array( 'current' => $current, 'deactivate' => $to_deactivate, ); }