| @@ -1579,8 +1579,21 @@ | ||
| 1579 | 1579 | return false; |
| 1580 | 1580 | } |
| 1581 | 1581 | |
| 1582 | 1582 | /** |
| 1583 | + * Whether the site is still on the pre-2026 feature gating. | |
| 1584 | + * | |
| 1585 | + * @return bool | |
| 1586 | + */ | |
| 1587 | + public function is_legacy_gating_site() { | |
| 1588 | + if ( ! method_exists( 'WPCOM_Features', 'is_legacy_gating_site' ) ) { | |
| 1589 | + return false; | |
| 1590 | + } | |
| 1591 | + | |
| 1592 | + return (bool) WPCOM_Features::is_legacy_gating_site( $this->blog_id ); | |
| 1593 | + } | |
| 1594 | + | |
| 1595 | + /** | |
| 1583 | 1596 | * Get the option of site intent which value is coming from the Hero Flow |
| 1584 | 1597 | * |
| 1585 | 1598 | * @return string |
| 1586 | 1599 | */ |
| @@ -1630,30 +1643,18 @@ | ||
| 1630 | 1643 | return array(); |
| 1631 | 1644 | } |
| 1632 | 1645 | |
| 1633 | 1646 | /** |
| 1634 | - * Whether the AI Launchpad is enabled for this site, for the requesting user. | |
| 1647 | + * Whether the AI Launchpad is enabled for this site. Mirrors AI_Launchpad::is_enabled_for_site() in jetpack-mu-wpcom. | |
| 1635 | 1648 | * |
| 1636 | - * The launchpad-personalization assignment is user-scoped: every site of an | |
| 1637 | - * ai_launchpad user gets the AI Launchpad, however the site was created. Mirrors | |
| 1638 | - * AI_Launchpad::is_enabled_for_site() in jetpack-mu-wpcom, so wp-admin and the | |
| 1639 | - * Calypso-facing payload agree. Like the capabilities in this payload, the value | |
| 1640 | - * is relative to the current user. | |
| 1641 | - * | |
| 1642 | 1649 | * @return bool |
| 1643 | 1650 | */ |
| 1644 | 1651 | public function is_ai_launchpad_enabled() { |
| 1645 | - if ( (bool) get_option( 'wpcom_ai_launchpad_enabled' ) ) { | |
| 1646 | - return true; | |
| 1647 | - } | |
| 1648 | - | |
| 1649 | - return class_exists( '\Automattic\Jetpack\Jetpack_Mu_Wpcom\Launchpad_Personalization_Experiment' ) | |
| 1650 | - // @phan-suppress-next-line PhanUndeclaredClassMethod -- Lives in jetpack-mu-wpcom, outside this plugin's dependency graph; the class_exists guard above covers contexts where it isn't loaded. | |
| 1651 | - && 'ai_launchpad' === \Automattic\Jetpack\Jetpack_Mu_Wpcom\Launchpad_Personalization_Experiment::get_variation(); | |
| 1652 | + return (bool) get_option( 'wpcom_ai_launchpad_enabled' ) && ! $this->is_ai_launchpad_no_guidance(); | |
| 1652 | 1653 | } |
| 1653 | 1654 | |
| 1654 | 1655 | /** |
| 1655 | - * Whether the AI Launchpad was dismissed, reverting the site to the regular launchpad. | |
| 1656 | + * Whether the AI Launchpad was dismissed (skipped), which leaves the site with no setup guidance. | |
| 1656 | 1657 | * |
| 1657 | 1658 | * @return bool |
| 1658 | 1659 | */ |
| 1659 | 1660 | public function is_ai_launchpad_dismissed() { |
| @@ -1669,8 +1670,22 @@ | ||
| 1669 | 1670 | return (bool) get_option( 'wpcom_ai_launchpad_completed' ); |
| 1670 | 1671 | } |
| 1671 | 1672 | |
| 1672 | 1673 | /** |
| 1674 | + * Whether the site gets no setup guidance: no My Home, Site Setup, or launchpad. Mirrors | |
| 1675 | + * wpcom_launchpad_is_no_guidance() in jetpack-mu-wpcom, which also counts a skipped AI Launchpad. | |
| 1676 | + * | |
| 1677 | + * @return bool | |
| 1678 | + */ | |
| 1679 | + public function is_ai_launchpad_no_guidance() { | |
| 1680 | + if ( get_option( 'wpcom_ai_launchpad_no_guidance' ) ) { | |
| 1681 | + return true; | |
| 1682 | + } | |
| 1683 | + | |
| 1684 | + return (bool) get_option( 'wpcom_ai_launchpad_enabled' ) && (bool) get_option( 'wpcom_ai_launchpad_dismissed' ); | |
| 1685 | + } | |
| 1686 | + | |
| 1687 | + /** | |
| 1673 | 1688 | * Get site option for migration source site domain |
| 1674 | 1689 | * |
| 1675 | 1690 | * @return string |
| 1676 | 1691 | */ |
| @@ -1879,6 +1894,16 @@ | ||
| 1879 | 1894 | */ |
| 1880 | 1895 | public function get_jetpack_recovery_mode_status() { |
| 1881 | 1896 | $status = get_option( 'jetpack_recovery_mode_status' ); |
| 1882 | 1897 | return is_array( $status ) ? $status : null; |
| 1898 | + } | |
| 1899 | + | |
| 1900 | + /** | |
| 1901 | + * Whether WordPress.com accounts must have two-step authentication to log in through SSO. | |
| 1902 | + * | |
| 1903 | + * @return bool | |
| 1904 | + */ | |
| 1905 | + public function get_jetpack_sso_require_two_step() { | |
| 1906 | + /** This filter is documented in projects/packages/connection/src/sso/class-helpers.php */ | |
| 1907 | + return (bool) apply_filters( 'jetpack_sso_require_two_step', get_option( 'jetpack_sso_require_two_step', false ) ); | |
| 1883 | 1908 | } |
| 1884 | 1909 | } |