is_wpcom_simple() ? Current_Plan::get_simple_site_specific_features() : Current_Plan::get()['features']; return in_array( self::FEATURE_SLUG, $features['active'] ?? array(), true ); } /** * Whether the Jetpack SEO surface should be discoverable (admin menu registered). * * @return bool */ public static function is_seo_surface_visible() { return Surface_Visibility::is_visible(); } /** * Whether to offer an existing install the chance to opt into the new SEO experience. * * @return bool */ public static function is_optin_available() { return Surface_Visibility::is_optin_available(); } /** * Whether the SEO dashboard is plan-gated for this site. * * Gating applies only on WordPress.com (Simple + Atomic): `advanced-seo` is in the * FREE plan's supports list, so `Current_Plan::supports( 'advanced-seo' )` returns * true on self-hosted (never gated) and hijacks to `wpcom_site_has_feature()` on * WordPress.com, where it's false below the Premium plan. Mirrors the AI SEO * Enhancer's plan check in {@see Dashboard_Data::get_ai_data()}. * * Public because {@see Admin_Page::inject_script_data()} reads it to build the * dashboard's gating payload, and {@see self::init()} uses it to decide whether the * GEO-tab front-end services register at all. * * @return bool */ public static function is_gated() { return ( new Host() )->is_wpcom_platform() && ! Current_Plan::supports( 'advanced-seo' ); } /** * The WordPress.com Premium checkout URL for this site, used by the upsell banner * shown to gated sites. * * Built server-side because the client doesn't have the site slug. `value_bundle` * is the wpcom Premium plan slug (see the `premium` entry in * `Automattic\Jetpack\Current_Plan`), and `Status::get_site_suffix()` resolves the * Calypso site slug (via `WPCOM_Masterbar::get_calypso_site_slug()` on wpcom). * * @return string */ public static function get_upsell_url() { $site_slug = ( new Status() )->get_site_suffix(); return sprintf( 'https://wordpress.com/checkout/%s/value_bundle', $site_slug ); } /** * Whether the `seo-tools` Jetpack module is currently active. * * @return bool */ private static function is_seo_tools_module_active() { if ( ! class_exists( 'Automattic\\Jetpack\\Modules' ) ) { return false; } return ( new Modules() )->is_active( 'seo-tools' ); } /** * Record that the user has turned the sitemap off, so WordPress core's own sitemap * is suppressed too. Hooked to the sitemaps module's deactivation, which fires only * on a real toggle from a surface (the SEO Settings tab, the legacy Traffic page, or * WP-CLI) — not wpcomsh's private-site suppression, which is a filter on the * active-modules read rather than a deactivation. * * @return void */ public static function flag_sitemap_user_disabled() { update_option( self::SUPPRESS_WP_SITEMAP_OPTION, true ); } /** * Clear the deliberate-off flag when the sitemap is turned back on — the Jetpack * sitemaps module then serves `/sitemap.xml` and suppresses core's duplicate itself. * * @return void */ public static function clear_sitemap_user_disabled() { delete_option( self::SUPPRESS_WP_SITEMAP_OPTION ); } }